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.
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 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:
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)
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.
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.
Package reference in the class.
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.
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)
@anthony.seure - I tried using following code,(After deploying the algoliasearch-apache-uber.jar in AEM). But i get some dependency error after deployment.
This error came up when I added index.saveObject(data). If I remove this statement then there is no such error in AEM Console.
Bundle shows error after deployment:
Hello @kurminkexam and thanks for taking the time to report your issue.
We’ve indeed noticed this remaining issue recently and fixed it in this pull request on Github https://github.com/algolia/algoliasearch-client-java-2/pull/709 which we plan to merge and release soon.
Once this will be released, you will then be able to download the new version (probably 3.11.0 or higher) to use the algoliasearch-apache-uber jAR as a working dependency (we’ve tested it in an actual AEM instance).
In the meantime, if this is blocking on your end, you can build the JAR yourself before the official release:
- Close the repository
- Checkout on the pull request branch
- Build the packages with
mvn clean package -DskipTests -Dmaven.javadoc.skip=true
- Use the generated uber JAR located under
The OSGi/AEM platforms are relatively new to us. Thank you for your patience and understanding while we do our best to make our Java library compliant with the OSGi bundling model.
Thanks @anthony.seure, Built the algoliasearch-apache-uber-3.10.0.jar and deployed.
Thank you for the update @kurminkexam and sorry for having you to build the JAR manually. We’re gonna deploy the official new version by tomorrow so you should be able to use an official JAR by EOD tomorrow or Monday.
Thank you again for your patience on this.