部署在 JBoss + Linux 上的 Web 应用程序出现 Jackson jar 冲突
Web Application Deployed on JBoss + Linux giving Jackson jar conflicts
访问上述配置的 spring 控制器时抛出以下异常:-
ERROR apiCategory - In error jsp with Exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jacksonMessageConverter' defined in ServletContext resource
[/WEB-INF/SMServlet-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.springframework.http.converter.json.MappingJacksonHttpMessageConverter]: Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.jackson.map.ObjectMapper
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1011)
我将它们与 war 一起运送,经过大量搜索后,我找到了解决此问题的方法。我通过 link :- https://developer.jboss.org/thread/150042 解决了这个问题。 jboss-classloading.xml 有一个小的变化,如下所示:-
<?xml version="1.0" encoding="UTF-8"?>
<classloading xmlns="urn:jboss:classloading:1.0"
**domain="warname/contextname"**
export-all="NON_EMPTY"
import-all="true" >
</classloading>
我只是将 xml 中的域名设置为 war name.It 更改了 JBoss class 加载程序策略,其中它优先考虑来自应用程序 lib.That 正是我想要的 :).
访问上述配置的 spring 控制器时抛出以下异常:-
ERROR apiCategory - In error jsp with Exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jacksonMessageConverter' defined in ServletContext resource
[/WEB-INF/SMServlet-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.springframework.http.converter.json.MappingJacksonHttpMessageConverter]: Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.jackson.map.ObjectMapper
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1011)
我将它们与 war 一起运送,经过大量搜索后,我找到了解决此问题的方法。我通过 link :- https://developer.jboss.org/thread/150042 解决了这个问题。 jboss-classloading.xml 有一个小的变化,如下所示:-
<?xml version="1.0" encoding="UTF-8"?>
<classloading xmlns="urn:jboss:classloading:1.0"
**domain="warname/contextname"**
export-all="NON_EMPTY"
import-all="true" >
</classloading>
我只是将 xml 中的域名设置为 war name.It 更改了 JBoss class 加载程序策略,其中它优先考虑来自应用程序 lib.That 正是我想要的 :).