jboss – 如何在一个Web应用程序中执行Jersey 1.6和axis2 1.3期间解决“java.lang.LinkageError:loader constraint violation”?

前端之家收集整理的这篇文章主要介绍了jboss – 如何在一个Web应用程序中执行Jersey 1.6和axis2 1.3期间解决“java.lang.LinkageError:loader constraint violation”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经使用axis2 1.3运行基于soap的Web服务.
这一天,我们计划使用Jersey 1.6开发RESTful Web服务.

我用axis2 1.3和Jersey 1.6创建了web应用程序(war文件),并尝试在jboss5.1.0上部署它.

启动jboss后,我看到下面的错误消息.

com.sun.jersey.api.container.ContainerException: Unable to create resource
    at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:139)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:533)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:531)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.getResourceComponentProvider(WebApplicationImpl.java:531)
.....
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:200)
    at com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:182)
    at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:137)
    ... 87 more
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.bind.JAXBElement.<init>(Ljavax/xml/namespace/QName;Ljava/lang/Class;Ljava/lang/Object;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class,com/sun/jersey/server/wadl/WadlGeneratorImpl,and the class loader (instance of <bootloader>) for resolved class,javax/xml/bind/JAXBElement,have different Class objects for the type javax/xml/namespace/QName used in the signature
    at com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponse(WadlGeneratorImpl.java:194)
    at com.sun.jersey.server.wadl.WadlBuilder.generateResponse(WadlBuilder.java:397)
    at com.sun.jersey.server.wadl.WadlBuilder.generateMethod(WadlBuilder.java:166)
    at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:308)
    at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:271)
    at com.sun.jersey.server.wadl.WadlBuilder.generate(WadlBuilder.java:107)
    at com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.getApplication(WadlApplicationContextImpl.java:76)
    at com.sun.jersey.server.impl.wadl.WadlResource.<init>(WadlResource.java:76)
    ... 94 more
14:23:18,155 ERROR [[/oasapi]] Servlet /oasapi threw load() exception
java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.bind.JAXBElement.<init>(Ljavax/xml/namespace/QName;Ljava/lang/Class;Ljava/lang/Object;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class,have different Class objects for the type javax/xml/namespace/QName used in the signature
    at com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponse(WadlGeneratorImpl.java:194)
    at com.sun.jersey.server.wadl.WadlBuilder.generateResponse(WadlBuilder.java:397)
    at com.sun.jersey.server.wadl.WadlBuilder.generateMethod(WadlBuilder.java:166)
.....

谁可以教我什么是问题以及如何解决这个问题?

谢谢

解决方法

您的环境中提供了两个版本的javax.xml.namespace.QName类:

>第一个是Java SE 6.>第二个似乎是由JBoss提供的

原文链接:https://www.f2er.com/html/226930.html

猜你在找的HTML相关文章