Incompatible neethi.jar with WAS 7

后端 未结 5 1321
情歌与酒
情歌与酒 2020-12-19 15:43

I am deploying one application Apache CXF-2.7.5 with neethi-3.0.2 in websphere 7. I am getting below error. My Application is spring driven. When I degraded Apache CXF to

相关标签:
5条回答
  • 2020-12-19 16:20

    I had to make 'parent_last' class loading at web module level and delete following jar files from WAR:-

    geronimo-servlet_3.0_spec-1.0.jar
    geronimo-javamail_1.4_spec-1.7.1.jar
    stax-api-1.0.1.jar
    

    This is because of the AssertionBuilderFactory was an implementation in 2.0.5 version of neethi.jar but is an interface in 3.0.2 which we are using due to CXF 2.7.5.

    Since these jar files are automatically added at build time due to CXF dependencies, I think we'll have to manually delete these jars from WAR before deployment in WAS. Also with each deployment, we'll have to change Class Loader setting for our WAR.

    To change the Class Loader order, use following path:- Enterprise Applications > MyApplicationWAR > Manage Modules > MyApplicationWAR

    EDIT:

    You can do the same from your POM file using <exclusions> tag

    <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-bundle-jaxrs</artifactId>
                <version>${cxf.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-javamail_1.4_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-servlet_3.0_spec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
    <!-- Jettison Dependency -->
            <dependency>
                <groupId>org.codehaus.jettison</groupId>
                <artifactId>jettison</artifactId>
                <version>${jettison.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>stax</groupId>
                        <artifactId>stax-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
    0 讨论(0)
  • 2020-12-19 16:26

    Yeah, it's possible that WAS is having an older version of neethi.

    You should check the lib folder of websphere to see if there's old version of neethi jar there. You may also need to configure your container to enable self-first classloading way if there's neethi version conflict.

    Another option is to deploy the required neethi.jar in endorsed directory and then start the VM with appropriate parameters.

    0 讨论(0)
  • 2020-12-19 16:35

    What impact does removing the following three jars have on the solution to the problem? I have a similar problem but with a junit test rather than running in WAS. I have neethi-3.0.1.jar and cxf-rt-core-2.7.4.jar in my pom. However I still get java.lang.IncompatibleClassChangeError: org.apache.neethi.AssertionBuilderFactory at at org.apache.cxf.bus.extension.Extension so I assume I am somehow still have older version of neethi on the classpath. How do I fix it? geronimo-servlet_3.0_spec-1.0.jar geronimo-javamail_1.4_spec-1.7.1.jar stax-api-1.0.1.jar

    0 讨论(0)
  • 2020-12-19 16:37

    Put the latest version neethi.jar in the endorsed directory within you Websphere's Java for a quick solution, restart your JVM's and try it out.

    0 讨论(0)
  • 2020-12-19 16:38

    I would suggest you to try setting the class loader properties of WAS. Set it to be application class loader first instead parent class loader. With this, WAS will pick up the jar that you have packaged within the application. HTH

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