Spring class loader issues in Jboss while using spring-ws client

前端 未结 2 740
小鲜肉
小鲜肉 2021-01-23 23:53

I have my application running properly in Jboss. To to write spring webservice client, i have generated classes using wsimport. I have written following in configur

相关标签:
2条回答
  • 2021-01-24 00:12

    This suggests to me that there are two versions of that JAR in your CLASSPATH - perhaps one on the server itself and another that's deployed as part of your app - and they aren't the same version. The server class loader will find the server version first, before your application class loader runs. If it's an earlier version than required by your app you'll have a problem.

    The solution is difficult, because you might not be able to remove the server version without compromising other deployed apps. See if there's a flag in the JBOSS configuration for your application to tell JBOSS to prefer JARs 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

    0 讨论(0)
  • 2021-01-24 00:18

    You could create WEB-INF/jboss-web.xml file for your application with next 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 classloader from looking for JBoss libs. As a downside you'll have to provide all your 3rd-party jars in a WAR/lib folder.

    This works for 4.2 you could lookup something similar for version you currently use.

    0 讨论(0)
提交回复
热议问题