Error with Solr integration with AEM | Community
Skip to main content
New Participant
November 6, 2023
Solved

Error with Solr integration with AEM

  • November 6, 2023
  • 1 reply
  • 776 views

Hi,

I am following the tutorial Solr integration with AEM (Java) to integrate SOLR with AEM. 

when I build the project, I get the error, but the bundle is active

 

 

[ERROR] The analyser found the following errors for author and publish : [ERROR] [api-regions-exportsimports] com.astellas:aem-astellas-project.core:0.0.1-SNAPSHOT: Bundle aem-astellas-project.core:0.0.1-SNAPSHOT is importing package(s) [org.apache.solr.common, org.apache.solr.client.solrj.impl, org.apache.solr.common.params, org.apache.solr.client.solrj.response, org.apache.solr.client.solrj] in start level 20 but no bundle is exporting these for that start level. (com.astellas:aem-astellas-project.all:0.0.1-SNAPSHOT)public class SolrIndexServlet extends SlingAllMethodsServlet { protected void doGet(final SlingHttpServletRequest req, final SlingHttpServletResponse resp) throws IOException { SolrClient solrClient = getSolrClient(); try { // Get all documents from practice collection //SolrQuery solrQuery = new SolrQuery("*:*"); // Get document having name as home SolrQuery solrQuery = new SolrQuery(); solrQuery.set("q", "name:home"); QueryResponse queryResponse = solrClient.query("practice", solrQuery); SolrDocumentList documents = queryResponse.getResults(); for(SolrDocument document : documents) { document.getFirstValue("name"); } } catch (SolrServerException e) { throw new RuntimeException(e); } } protected void doPost(final SlingHttpServletRequest req, final SlingHttpServletResponse resp) throws IOException { // POST the data to solr having name and id as home. SolrInputDocument doc = new SolrInputDocument(); doc.addField("name", "home"); /* Provide custom id as page path or some unique value. It will help us to update same record as part of next update, sync or POST data in place of creating new or duplicate document. */ doc.addField("id", "home"); SolrClient solrClient = getSolrClient(); try { solrClient.add("practice", doc); solrClient.commit("practice"); } catch (SolrServerException e) { throw new RuntimeException(e); } } protected void doDelete(final SlingHttpServletRequest req, final SlingHttpServletResponse resp) throws IOException { SolrClient solrClient = getSolrClient(); try { // Use below code to Delete all documents // solrClient.deleteByQuery("*"); // Delete specific document having id == home and name == home solrClient.deleteByQuery("practice", "(id:home) AND (name:home)"); solrClient.commit("practice"); } catch (SolrServerException e) { throw new RuntimeException(e); } } private static Http2SolrClient getSolrClient() { return new Http2SolrClient.Builder("http://localhost:8983/solr") .connectionTimeout(50000) .build(); }

 

Could you please advise how can I  solve it.

 

Best regards!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

This error message indicates that the bundle `aem-astellas-project.core` is importing packages related to Apache Solr (e.g., `org.apache.solr.common`, `org.apache.solr.client.solrj.impl`), but there are no bundles exporting these packages at the specified start level (20).

Here are some steps to help you resolve this issue:

1. **Check Bundle Dependencies:**
- Ensure that all the required Apache Solr-related dependencies are correctly specified in the `Import-Package` section of your `aem-astellas-project.core` bundle's manifest file.

2. **Check OSGi Configuration:**
- Verify that the Apache Solr-related bundles are correctly installed and active in your AEM instance.
- Make sure the start level (in this case, 20) is appropriate for the bundles exporting the required packages.

3. **Resolve Versioning Conflicts:**
- Check for versioning conflicts between the versions specified in the `Import-Package` section and the actual versions available in the AEM instance. Ensure that the versions match or are compatible.

4. **Update Maven Dependencies:**
- If you are using Maven for your AEM project, make sure that the dependencies in your `pom.xml` file are correctly specified and are compatible with each other.

5. **Update Dependencies:**
- If you are using outdated versions of Apache Solr-related dependencies, consider updating them to the latest compatible versions.

 

Hope this can give you some clues.

1 reply

EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
November 15, 2023

This error message indicates that the bundle `aem-astellas-project.core` is importing packages related to Apache Solr (e.g., `org.apache.solr.common`, `org.apache.solr.client.solrj.impl`), but there are no bundles exporting these packages at the specified start level (20).

Here are some steps to help you resolve this issue:

1. **Check Bundle Dependencies:**
- Ensure that all the required Apache Solr-related dependencies are correctly specified in the `Import-Package` section of your `aem-astellas-project.core` bundle's manifest file.

2. **Check OSGi Configuration:**
- Verify that the Apache Solr-related bundles are correctly installed and active in your AEM instance.
- Make sure the start level (in this case, 20) is appropriate for the bundles exporting the required packages.

3. **Resolve Versioning Conflicts:**
- Check for versioning conflicts between the versions specified in the `Import-Package` section and the actual versions available in the AEM instance. Ensure that the versions match or are compatible.

4. **Update Maven Dependencies:**
- If you are using Maven for your AEM project, make sure that the dependencies in your `pom.xml` file are correctly specified and are compatible with each other.

5. **Update Dependencies:**
- If you are using outdated versions of Apache Solr-related dependencies, consider updating them to the latest compatible versions.

 

Hope this can give you some clues.

Esteban Bustamante