#community-help

Java Client Issue: Creating New Instance Error

TLDR Nader had a problem creating a new instance with the Java client due to a protected constructor error. Kishore Nallan responded with a commitment to fix the client to resolve the issue.

Powered by Struct AI
Feb 10, 2022 (21 months ago)
Nader
Photo of md5-7845a03b52066c14e3328c0694757348
Nader
10:03 PM
hey folks! Does anyone using the java client know how to create a new instance from the client following this example?

ArrayList<Node> nodes = new ArrayList<>();
nodes.add(
  new Node(
    "http",       // For Typesense Cloud use https
    "localhost",  // For Typesense Cloud use 
    "8108"        // For Typesense Cloud use 443
  )
);

Configuration configuration = new Configuration(nodes, Duration.ofSeconds(2),"<API_KEY>");

Client client = new Client(configuration);

it is not working for me as the Client has a package protected constructor.

this is the error I am getting: error: Client(Configuration) is not public in Client; cannot be accessed from outside package
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:11 PM
Hmmm, it's been a long time since I wrote Java, but I wonder why the constructor is not public...

Harisaran - any thoughts on this?
Feb 11, 2022 (21 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:41 AM
I will be fixing the client today.
Feb 13, 2022 (21 months ago)
Nader
Photo of md5-7845a03b52066c14e3328c0694757348
Nader
06:30 PM
thank you!!