使用 spring-ws 客户端时 Jboss 中的 Spring 类加载器问题

2023-12-12

我的应用程序在 Jboss 中正常运行。为了编写 spring webservice 客户端,我使用生成了类wsimport。我在配置中写了以下内容

 <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
    <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
</property>

在 jboss?lib 我有jboss-jaxws.jar,spring.jar...现在我复制了

spring-ws-1.5.0.jar and  saaj-impl-1.3.jar

但我收到以下错误:

The Spring ContextLoaderListener we wrap threw on contextInitialized.
But for our having caught this error, the web application context would not have initialized.
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalArgumentException: Class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not implement the NamespaceHandler interface
Caused by: 
java.lang.IllegalArgumentException: Class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not implement the NamespaceHandler interface
    at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.initHandlerMappings(DefaultNamespaceHandlerResolver.java:119)

请帮我解决这个错误。这些错误是我在保留这些罐子后才出现的。但这些需要运行我的新代码。请建议我如何避免它们?


这对我来说表明您的 CLASSPATH 中有该 JAR 的两个版本 - 一个可能在服务器本身上,另一个作为您的应用程序的一部分部署 - 并且它们不是同一版本。在应用程序类加载器运行之前,服务器类加载器将首先查找服务器版本。如果它的版本比您的应用程序要求的版本早,您就会遇到问题。

该解决方案很困难,因为您可能无法在不影响其他已部署应用程序的情况下删除服务器版本。查看您的应用程序的 JBOSS 配置中是否有一个标志,告诉 JBOSS 优先选择由应用程序类加载器加载的 JAR,看看这是否有帮助。

http://www.datadisk.co.uk/html_docs/java_app/jboss5/jboss5_deployment.htmhttp://community.jboss.org/wiki/ClassLoadingConfigurationhttp://community.jboss.org/wiki/JBossClassLoadingUseCases

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 spring-ws 客户端时 Jboss 中的 Spring 类加载器问题 的相关文章

随机推荐