引起:java.lang.VerifyError:无法链接com/fasterxml/jackson/databind/type/ReferenceType:无法从最终类继承

Kri*_*sad 4 java mongodb hdfs apache-spark

我使用的是 Spring 版本 4.3.13.RELEASE、Spark 版本 2.2.0-2.11、mongo-spark-connector_2.11(2.2.0)、jackson 2.8.9。我的应用程序在 Tomcat7 中运行良好,但在 Wildfly10 中出现异常

org.springframework.web.util.NestedServletException:处理程序调度失败;嵌套异常是 java.lang.VerifyError: Failed to link com/fasterxml/jackson/databind/type/ReferenceType (Module "deployment.app.war:main" from Service Module Loader): 无法从 org.springframework 的最终类继承。 web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982) 在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 970) 在 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 在 org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:846) 在 javax.servlet.http。

Vig*_*hiv 7

由 maven 或 gradle war 插件创建的 spring boot 2.0 war 将适用于 jboss EAP 7.1。同样的 war 文件将通过 jboss EAP 7.0 服务器上的异常。

The exception is java.lang.VerifyError: Failed to link com/fasterxml/jackson/databind/type/ReferenceType
Run Code Online (Sandbox Code Playgroud)

出现部署异常是因为 jboss 有自己的 jackson 库,并且发生类加载时间验证错误。

SOLUTION : 这个问题的解决方案是在WEB-INF文件夹中添加一个名为jboss-deployment-structure.xml的特定于jboss的xml文件。

<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<exclusions>
<module name="com.fasterxml.jackson.core.jackson-annotations" />
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.slf4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Run Code Online (Sandbox Code Playgroud)


小智 0

我在 EAP 6.4 中运行应用程序时遇到相同的错误,如下所示, 我已迁移到 EAP 7.1.0,错误得到解决,应用程序运行良好。这是因为 jboss EAP6 中的 jakson jar 版本较旧,请参阅https://issues.jboss.org/browse/JBEAP-5189现在已在 7.x 版本中解决

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'httpPutFormContentFilter' defined in class path resourc
 [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org
springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter]: Fac
ory method 'httpPutFormContentFilter' threw exception; nested exception is java.lang.VerifyError: Failed to link com/fasterxml/jackson/databind/type/Refer
nceType (Module "deployment.acsm.ear.CCP-API-0.0.1-SNAPSHOT.war:main" from Service Module Loader): Cannot inherit from final class
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.j
va:1254)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:225)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:181)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:176)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:158)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:80)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationCo
text.java:250)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:237)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152)
        ... 18 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedHttpPutFormCont
ntFilter]: Factory method 'httpPutFormContentFilter' threw exception; nested exception is java.lang.VerifyError: Failed to link com/fasterxml/jackson/data
ind/type/ReferenceType (Module "deployment.acsm.ear.CCP-API-0.0.1-SNAPSHOT.war:main" from Service Module Loader): Cannot inherit from final class
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
        ... 35 more
Caused by: java.lang.VerifyError: Failed to link com/fasterxml/jackson/databind/type/ReferenceType (Module "deployment.acsm.ear.CCP-API-0.0.1-SNAPSHOT.war
main" from Service Module Loader): Cannot inherit from final class
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
Run Code Online (Sandbox Code Playgroud)