0

I need to perform a Solr query from my Quarkus application. I started using SolrJ, which worked well.

However, to be able to create a native image, I had to configure this:

quarkus.native.additional-build-args=--initialize-at-run-time=org.apache.http.impl.auth
quarkus.ssl.native=true

Then everything worked fine using HttpSolrClient.

However, our installation requires me to use ZooKeeper. So I rewrote my client using CloudHttp2SolrClient, which worked well in dev mode.

But as soon as I wanted to create a native image, I got more errors because of class initialization.

So the configuration is now

quarkus.native.additional-build-args=--initialize-at-run-time=org.apache.http.impl.auth\\,org.apache.zookeeper\\,org.apache.solr.client.solrj.routing
quarkus.ssl.native=true

With this, I can build the image and start the container.

But when I try to use that code, I get

org.apache.solr.common.SolrException: java.io.IOException: Couldn't instantiate org.apache.zookeeper.ClientCnxnSocketNIO
...
Caused by: java.io.IOException: Couldn't instantiate org.apache.zookeeper.ClientCnxnSocketNIO
  at org.apache.zookeeper.ZooKeeper.getClientCnxnSocket(ZooKeeper.java:3407)
...
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.ClientCnxnSocketNIO
  at [email protected]/java.lang.Class.forName(DynamicHub.java:1132)

Zookeeper is apparently dynamically getting classes, which of course doesn't play well with Quarkus.

So: How can I fix this? I saw that there is a Quarkus Zookeeper Client. But I don't know whether I can run a Solr query from it.

Does anyone have any experience with querying Solr from Quarkus?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.