Elasticsearch在Tomcat 7上导致带有javax / servlet / FilterConfig的java.lang.LinkageError(Elasticsearch causi

编程入门 行业动态 更新时间:2024-10-13 12:19:42
Elasticsearch在Tomcat 7上导致带有javax / servlet / FilterConfig的java.lang.LinkageError(Elasticsearch causing java.lang.LinkageError with javax/servlet/FilterConfig on Tomcat 7)

我使用的是Elasticsearch 1.1.1 ,java客户端和服务器版本是一样的。 单元测试都运行良好。 当我启动tomcat服务器时,它具有:

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/FilterConfig"

在那个错误之前,有很多以下内容:

2014-05-02 15:07:03,954 DEBUG o.e.plugins [localhost-startStop-1] [Corsair] [D:\eclipse-indigo\plugins\org.python.pydev.jython_2.7.0.2012080220\_site] directory does not exist.

很多和不同的文件夹

如果我删除使用elasticsearch并在pom.xml中保持依赖关系的代码,服务器就可以正常启动了。 WEB-INF/lib和我的应用程序的类路径没有servlet-api.jar ,它只在TOMCAT_HOME/lib

我设置es客户端的部分如下:

if (this.client == null) { this.client = new TransportClient(ImmutableSettings.settingsBuilder(). put("cluster.name", this.cluster).build()); final String[] addresses = this.hosts.split(","); for (final String address : addresses) { final String trimmed = address.trim(); final String[] tuple = trimmed.split(":"); this.client.addTransportAddress( new InetSocketTransportAddress(tuple[0].trim(), Integer.valueOf(tuple[1].trim()))); } }

相同的代码用于单元测试,它通过所有测试。

非常感谢任何指针。

这似乎是相关的,但没有提供适当的解决方案。

在Spring WebApp中使用Elasticsearch客户端时出现链接错误

仅供参考,我也使用Spring&Spring MVC 4.2.5.RELEASE,Tomcat 7.0.40版

更新:

感谢这个链接http://lexxweb.co.uk/blog/?p=66 ,事实证明它是eclipse插件之一,它加载了另一个版本的servlet-api,导致我得到的LinkageError。

I am using Elasticsearch 1.1.1, java client and server versions are the same. Unit tests all run fine. when i start tomcat server, it has:

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/FilterConfig"

and before that error, there were a lot of the following:

2014-05-02 15:07:03,954 DEBUG o.e.plugins [localhost-startStop-1] [Corsair] [D:\eclipse-indigo\plugins\org.python.pydev.jython_2.7.0.2012080220\_site] directory does not exist.

a lot of that and with different folders

if i remove the code that uses elasticsearch and keeping the dependency in pom.xml, server starts fine. WEB-INF/lib and my app's classpath does not have a servlet-api.jar, its only in TOMCAT_HOME/lib

the part i set up an es client is as follow:

if (this.client == null) { this.client = new TransportClient(ImmutableSettings.settingsBuilder(). put("cluster.name", this.cluster).build()); final String[] addresses = this.hosts.split(","); for (final String address : addresses) { final String trimmed = address.trim(); final String[] tuple = trimmed.split(":"); this.client.addTransportAddress( new InetSocketTransportAddress(tuple[0].trim(), Integer.valueOf(tuple[1].trim()))); } }

The same code is used for unit tests and it passes all tests.

Any pointer is much appreciated.

This seems to be relevent but haven't been provided a proper solution.

Linkage error when using Elasticsearch client in Spring WebApp

FYI, I am also using Spring & Spring MVC 4.2.5.RELEASE, Tomcat version 7.0.40

UPDATE:

Thanks to this link http://lexxweb.co.uk/blog/?p=66, it turns out that it is one of the eclipse plugin which loads another version servlet-api, causing the LinkageError I've been getting.

最满意答案

感谢这个链接http://lexxweb.co.uk/blog/?p=66 ,事实证明它是eclipse插件之一,它加载了另一个版本的servlet-api,导致我得到的LinkageError。 删除插件后,现在一切都很好

Thanks to this link http://lexxweb.co.uk/blog/?p=66, it turns out that it is one of the eclipse plugin which loads another version servlet-api, causing the LinkageError I've been getting. After deleting the plugin, everything is good now

更多推荐

本文发布于:2023-08-05 21:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1440904.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:javax   servlet   Elasticsearch   Tomcat   FilterConfig

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!