我正在开发一个大型应用程序,我刚刚在轴的帮助下添加了一个由 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 的回复感兴趣,但他们的解决方案对我来说并不清楚,特别是:“这可能意味着将其从类路径中删除并作为插件加载”。
- 这适用于应用程序端还是网络逻辑端?
- 尽管我对 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...