gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 19:28:46 25 4
gpt4 key购买 nike

我已经有基于肥皂的网络服务与 axis2 1.3 一起运行。今天,我们计划使用 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, 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)
.....

谁能告诉我问题是什么以及如何解决这个问题?

谢谢

最佳答案

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

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

关于jboss - 如何在一个 Web 应用程序中执行 Jersey 1.6 和 axis2 1.3 期间解决 "java.lang.LinkageError: loader constraint violation"问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5543125/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com