Com.algolia.search -- Cannot be resolved

Hi All,

I am in the process of integrating Aloglia search into AEM through magento. Requirement is, If user try to search then all content & assets will be retrieved from AEM.

I am using Java 3 API client call into AEM. Based on Aloglia Java client installation document, I included algolia reference in pom.xml. I have got “com.algolia.search – Cannot be resolved” error. Any help would be appreciated.

com.algolia algoliasearch-core 3.6.1 com.algolia algoliasearch-apache 3.6.1

Hi,

To have the Java API client working in an AEM environment it must be built as an OSGI bundle. We are currently working on this. Could you please try the solution provided here and let us know if that would work for you?

Thanks!

Hi,

Thanks for the response. I tried as you mentioned in the link. But still getting the same issue
Please check below screen shot. Let me know if I missed out anything.

Hello @bramakrishnan and thank you for the detailed error,

AEM environment is relatively new to us but we would be happy to better integrate our Java library with it. The pull request which my colleague @antoine.hemery mentioned is the first step in that direction: it makes sure that our Apache Uber JAR, which you can find here, is a valid OSGi bundle that you can import in an AEM application.

Your issue does not seem to be related to the build itself but to the dependency fetching. I can see two potential issues here:

  1. either your application is not able to load libraries from the Maven Central repository, in that case, I’d recommend you to ensure it’s correctly configured (we are interested if you make any progress here, since we don’t have an AEM environment at hand)

  2. or your application correctly fetch our Algolia dependency but is not considered a valid OSGI bundle (the pull request I’ve shared with you is not yet released, it will be in the next coming days in an upcoming 3.10.0 version)

I’m really interested to hear from you regarding my first point. Feel free to send us links that we could follow to learn more about dependency fetching in AEM.

Hello Anthony,

I tried to install bundle from this path to AEM. But installation is failed. It seems, jar file is not valid osgi bundle. Please verify attached error screen shot.

Thank you for the details, it seems to confirm my second guess then. I’ve just released our Java API client v3.10.0, which should be available on Maven Central now (or under 24h depending on Maven Central repositories status). Once it’s available, could you give it a try with our Apache Uber JAR (only one made OSGi-compliant at the moment) and tell me if the cannot install bundle error is fixed on your end.

Thank you again for your patience on this and your help to better integrate our Java library with AEM.

Thank you for the release 3.10 version. It resolves partially my issue.

However, I am experiencing another issue related to latest uber jar. If I create instance of “HttpAsyncClientBuilder” class then bundle throws “com.algolia.search.org.apache.http.impl.nio.client.HttpAsyncClientBuilder” can’t be resolved.

Bundle error

Package reference in the class.

Hello @bramakrishnan,

We are not able to reproduce your issue locally using an HttpAsyncClientBuilder with the algoliasearch-apache-uber dependency as of v3.10.0.

Could you share with us the exact Algolia code you are using, including the imports you have at the top of the file? Don’t forget to remove or obfuscate your Algolia credentials if any before sharing.

Custom Class with object creation in eclipse and class compiled without any issue

Bundle throws error after the deployment

Let me know if you need additional details

At this point, we are mostly clueless since you can correctly build but not run it. Our last guess would be to suggest you to investigate the AEM runtime setup to see if you did not forget to install the Algolia dependency there as bundle. Perhaps the Algolia bundle is simply not installed/loaded when you start your own bundle, while it is needed. If this doesn’t work, I think your team contacted us to have a call. I’ll make myself available on that day.

Best.

There is no change in algolia dependency bundle. Status shows as “Active”. We can do screen sharing to move further. Let me know your availability. I am available during my day time (US ET)