【发布时间】:2015-10-29 15:54:57
【问题描述】:
我正在开发一个大型应用程序,我刚刚在轴的帮助下添加了一个由 eclipse 生成的新 Web 服务。 该应用程序在我的开发环境(应用程序由码头托管)中运行良好,但现在我在 weblogic 中运行我的应用程序时遇到了麻烦(需要部署应用程序)。 我得到的错误是:
java.lang.LinkageError: loader constraint violation in interface
itable initialization: when resolving method
"org.apache.axis.client.Service.getServiceName()Ljavax/xml/namespace/QName;"
the class loader (instance of
weblogic/utils/classloaders/ChangeAwareClassLoader) of the current
class, org/apache/axis/client/Service, and the class loader (instance
of sun/misc/Launcher$AppClassLoader) for interface
javax/xml/rpc/Service have different Class objects for the type
getServiceName used in the signature
这个问题已经耽误了几天的开发。 据我在网上了解:
- 我的 Axis 依赖项包含类:org.apache.axis.client.Service,它遵循 javax.xml.rpc.Service 接口。
- 我的Weblogic提供了接口: javax.xml.rpc.Service
- 由于它们位于不同的路径(应用程序和 weblogic)中,它们由不同的类加载器加载
第一个问题:我的观察是否正确?
第二个问题:我可以做什么/尝试解决这个问题?
额外信息:
- 使用 Maven。
- 为确保 Weblogic 加载的所有依赖项在我们的开发环境中也可用,我们添加了 wlsfullclient.jar 作为依赖项(仅在我们的开发环境中)。
- 由于很多项目都在使用我们的 weblogic 服务器,所以我不能只将 Axis jar 添加到 weblogic 路径中。
- 我在 Stack 上发现了一个类似的问题:How to deal with LinkageErrors in Java?。
- 尽管我对 Alex Miller 的回复很感兴趣,但他们的解决方案对我来说并不清楚,特别是:“这可能意味着将其从类路径中删除并作为插件加载”。
- 这适用于应用程序端还是 Web 逻辑端?
- 尽管我对 Alex Miller 的回复很感兴趣,但他们的解决方案对我来说并不清楚,特别是:“这可能意味着将其从类路径中删除并作为插件加载”。
- 如果需要更多信息,我很乐意提供。
编辑: 我的项目中有一个 weblogic.xml,内容如下:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app >
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
<context-root>auditgui</context-root>
</weblogic-web-app>
我的WAR文件结构如下:
file.war
|--crossdomain.xml
|--robots.txt
|--META-INF
| \--MANIFEST.MF
|--WEB-INF
| |--classes
| | |--com
| | | \--...
| | |--spring
| | | |--main-context.xml
| | | \--security-context.xml
| | \--environment-beans.xml
| |--lib
| | \--multiplejars.jar
| |--spring
| | |--raw-servlet-context.xml
| | |--root-context.xml
| | \--servlet-context.xml
| |--web.xml
| \--weblogic.xml
|--css
| \--multipleCSSFiles.css
|--js
| \--multipleJSFiles.js...
|--img
| \--muultipleImages.png...
\--multipleHTMLFiles.html...
【问题讨论】:
标签: java maven weblogic axis linkageerror