Spring class loader problems in Jboss when using spring-ws client

I have an application that works correctly in Jboss. To write the spring webservice client, I created classes using wsimport . I wrote the following in configuration

  <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> 

in jboss? lib i have jboss-jaxws.jar,spring.jar ... Now I copied

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

but I get the following errors:

 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) 

Please help me resolve this error. I get these errors only after storing these cans. But this required the launch of my new code. Please suggest me how to avoid them?

+1
source share
2 answers

You can create the WEB-INF / jboss-web.xml file for your application with the following content

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd"> <jboss-web> <class-loading java2ClassLoadingCompliance="false"> <loader-repository> myapp:loader=anyUniqueName <loader-repository-config>java2ParentDelegation=false</loader-repository-config> </loader-repository> </class-loading> </jboss-web> 

This should prevent the JBoss bootloader class loader. As a disadvantage, you will have to provide all your third-party banks in the WAR / lib folder.

This works for 4.2, you may find something similar for the version you are currently using.

+1
source

This suggests that your CLASSPATH has two versions of this JAR: perhaps one on the server itself and another that is deployed as part of your application - and they are not the same version. First, the server class loader will find the server version before your application loader starts. If this is an earlier version than your application requires, you will have a problem.

The solution is difficult because you cannot uninstall the server version without affecting other deployed applications. See if there is a flag in the JBOSS configuration for your application to tell JBOSS about the JAR preferences loaded by the application class loader and see if that helps.

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

+2
source

Source: https://habr.com/ru/post/1332944/


All Articles