我正在尝试使用Adobe Experience Manager中的Java High Level Rest Client完成Lucene,Solr和Elasticsearch搜索引擎之间的比较的项目。] >>
我在elasticsearh实现]中遇到一些问题。这是代码:
父pom.xml中的依赖关系(在核心pom.xml中定义相同)
<!-- Elasticseach dependencies -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.4.0</version>
</dependency>
我正在使用的唯一代码行来自上面的依赖项
try (RestHighLevelClient client = new
RestHighLevelClient(RestClient.builder(new HttpHost(server, port,
protocol),
new HttpHost(server, secondPort, protocol)));)
{
}
catch (ElasticsearchException e)
{
LOG.error("Exception: " + e);
}
协议=“ http”,服务器=“本地主机”,端口= 9200,secondPort =9201
We.Retail
项目上完成,因此很容易复制。同样,所有具有此错误的代码也可以在这里找到:https://github.com/tadijam64/search-engines-comparison-on-we-retail/tree/elasticsearch-integrationAEM 6.4v。任何信息或想法都值得赞赏。UPDATE
我尝试添加以下内容以将这些依赖项从外部嵌入,因为它们不是OSGi依赖项:<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>org.apache.servicemix.bundles.solr-solrj, log4j, noggit, zookeeper,
elasticsearch-rest-high-level-client
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Export-Package>we.retail.core.model*</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<Private-Package>we.retail.core*</Private-Package>
<Sling-Model-Packages>
we.retail.core.model
</Sling-Model-Packages>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
错误仍然存在。我也尝试将其添加到“ export-package”中,但没有帮助。[通过Elasticsearch documentation,我只需要使用Elasticsearch是
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.4.0</version>
</dependency>
但随后一些其他建议可以在这里找到:https://forums.adobe.com/thread/2653586NoClassDefFoundErrors
发生。传递依赖似乎是一个问题。不确定,但是任何想法都值得赞赏。
我还尝试添加它的传递依赖项,例如org.elasticsearch和org.elasticsearch.client,但是它不起作用。同样的错误,只是其他类。
[AEM版本6.4,Java版本:jdk1.8.0_191.jdk我正在尝试使用Adobe Experience Manager中的Java High Level Rest Client来完成Lucene,Solr和Elasticsearch搜索引擎之间的比较项目。我在...
在问题[ elasticsearch我已经在pom.xml中添加了所有
(版本在parent / pom.xml中定义):
<!-- Elasticsearch -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-x-content</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>rank-eval-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-imaging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
</dependency>
maven-bundle-plugin内将所有第三方依赖项添加为<< [嵌入依赖项] >>,如下所示:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>org.apache.servicemix.bundles.solr-solrj, noggit,
elasticsearch-rest-high-level-client,
elasticsearch,
elasticsearch-rest-client,
elasticsearch-x-content,
elasticsearch-core,
rank-eval-client,
lang-mustache-client,
httpasyncclient;
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Export-Package>we.retail.core.model*</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<Private-Package>
we.retail.core*
</Private-Package>
<Sling-Model-Packages>
we.retail.core.model
</Sling-Model-Packages>
<_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
</instructions>
</configuration>
</plugin>
重要提示:所有第三方依赖性(OSGi以外的依赖性)必须包含在“嵌入依赖性”中“ Embed-Transitive”必须设置为true才能包含可传递依赖项
<_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>