0

I'm using the grails cxf-Plugin and it works fine locally, but I get an Erro when i deploy it on an tomcat server:

ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'cxf': 
Instantiation of bean failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: 
Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
... 5 more
Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.
        at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:183)
at org.apache.cxf.bus.extension.Extension.getClassObject(Extension.java:199)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAllByType(ExtensionManagerImpl.java:144)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:180)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:192)
at org.apache.cxf.bus.spring.SpringBus.<init>(SpringBus.java:45)
... 5 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.cxf.bus.extension.Extension.tryClass(Extension.java:164)
... 10 more

here is a snippet of my BuildConfig:

    compile ":ws-client:1.0"
    compile ":cxf-client:2.1.1"
    compile ":cxf:2.1.1"

I build a war file with grails war and deploy it on an Tomcat Server I have checked the WEB-INF/lib folder of the Project on the Tomcat Server and there are the jar's:

cxf-bundle-2.2.4.jar
cxf-core-3.0.4.jar
cxf-rt-bindings-soap-3.0.4.jar
cxf-rt-bindings-xml-3.0.4.jar 
cxf-rt-databinding-jaxb-3.0.4.jar
cxf-rt-frontend-jaxrs-3.0.4.jar
cxf-rt-frontend-jaxws-3.0.4.jar
cxf-rt-frontend-simple-3.0.4.jar
cxf-rt-security-3.0.4.jar
cxf-rt-transports-http-3.0.4.jar
cxf-rt-ws-addr-3.0.4.jar
cxf-rt-wsdl-3.0.4.jar
cxf-rt-ws-policy-3.0.4.jar
cxf-rt-ws-security-3.0.4.jar
cxf-tools-common-3.0.4.jar
cxf-tools-validator-3.0.4.jar
cxf-tools-wsdlto-core-3.0.4.jar
cxf-tools-wsdlto-databinding-jaxb-3.0.4.jar
cxf-tools-wsdlto-frontend-jaxws-3.0.4.jar

Why do I get this Error on the Tomcat Server?

YAT
  • 456
  • 1
  • 4
  • 14

1 Answers1

2

I had the same issue and I spent quite some time to figure it out. Some people also posted this issue on SO:

cxf-failing-with-incompatibleclasschangeerror-exception-on-unit-test

could-not-load-extension-class-org-apache-cxf-ws-policy-assertionbuilderregistry

AssertionBuilderRegistry Loading failed because it is an interface and extends AssertionBuilderFactory, while in older version of neethi library, AssertionBuilderFactory is defined as a concrete class. Thus IncompatibleClassChangeError is thrown.

About reasons for IncompatibleClassChangeError :

what-causes-java-lang-incompatibleclasschangeerror

In conclusion, you need to upgrade neethi library version.

Community
  • 1
  • 1
PickBoy
  • 1,234
  • 1
  • 13
  • 20
  • I still can't fix that Problem, upgrading neethi libary version to 3.0.3 doesn't helped. – YAT Feb 26 '16 at 09:35