1

I have a use-case wherein I have to connect objectbox from Java to server instance.

I tried with Sync but getting error stating "sync not supported". Below is my code,

BoxStore boxStore = MyObjectBox.builder().name("TestEntity-db").build();
Box<TestEntity> box = boxStore.boxFor(TestEntity.class);
boolean syncAvailable = Sync.isAvailable();
System.out.println("ObjectBox Sync is " + syncAvailable);         
SyncClient syncClient = Sync.client( boxStore, "ws://12.456.672.89:9999", SyncCredentials.none() ).buildAndStart();

Can someone help in this?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
  • You need ObjectBox Sync for this. You can apply for it here: https://objectbox.io/sync/ – Markus Junginger Jan 16 '23 at 10:33
  • @MarkusJunginger - If u could see the code which is attached above I have used Sync clinet to connect but getting an exception "This library does not include ObjectBox Sync Server. "Please visit https://objectbox.io/sync/ for options." from syncServerBuilder. I am using Java Spring Boot, not an android project. Can you help with this. – Saranya Karuppasamy Jan 17 '23 at 11:08
  • The shared code uses a client, not a server. Thus, it is expected that it will tell you that it does not include a server. – Markus Junginger Jan 17 '23 at 12:28
  • Hi @MarkusJunginger - Please find the below code which uses the sync server from Java Application , BoxStore boxStore = MyObjectBox.builder().name("TestEntity-db").build(); Box box = boxStore.boxFor(TestEntity.class); boolean syncAvailable = Sync.isServerAvailable(); System.out.println("ObjectBox Sync is " + syncAvailable); SyncServer syncServer = Sync.server(boxStore, "ws://12.456.672.89:9999", SyncCredentials.none()).buildAndStart(); Getting error , "This library does not include ObjectBox Sync Server. Please visit https://objectbox.io/sync/ for options." – Saranya Karuppasamy Jan 18 '23 at 12:35
  • I'm a bit confused about the intended setup. Do you actually want an embedded ObjectBox Sync server running in your process? Maybe a Sync client connecting to an existing Sync Server could be an option too? I realized we are in touch outside of stackoverflow already; let's continue there? – Markus Junginger Jan 19 '23 at 13:35
  • Yes Sure @MarkusJunginger will continue there – Saranya Karuppasamy Jan 23 '23 at 09:53

0 Answers0