Incompatible neethi.jar with WAS 7

五迷三道 提交于 2019-11-29 11:22:38

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>

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.

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!