20 junho 2012

JBoss 7.1.1 and CXF WS Client

JBoss 7.1.1 has a slightly small bug that prevents one to use a WS Client (implemented on JBoss with Apache CXF). This issue has already been reported to the JBoss WS component and fixed on JBoss EAP 6.0.0 ER 5 (see this specific issue ticket).

This is the stack trace you may see on your server.log:


Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @15cda3f (roots: /opt/dev/servers/jboss-as-7.1.1.Final/modules)]
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
  ... 96 more


If you have JBoss EAP and a license, just update it. But if you are on JBoss 7.1.1, you have two options to workaround this problem:

  1. One is updating JBoss WS to the upcoming 4.1.0 release (still in beta and it seems it has not been released publicly).
  2. Your best option is to add a Spring module to your JBoss instance and then add a dependency on Spring to the CXF module:

How to add a Spring module to JBoss AS 7?

First thing to do is to choose the best version of Spring. Prefer the latest one (in the time of this writing, 3.1.1). But if your application is using 3.0.x, pick the latest version of this branch.
  1. On the jboss-as-7.1.1-Final folder, create this path:
    • modules/org/springframework/spring/main
      • on Unix, you can do this using $ mkdir -p <path>
  2. Add the following module.xml to this newly created folder
  3. Download these JARs and add them to this  newly created folder
  4. Open this file
    • jboss-as-7.1.1-Final/modules/org/apache/cxf/main/module.xml
  5. At the end of this file, make sure you have this module dependency:
    • <module name="org.springframework.spring" />
Restart your application server.

Um comentário:

Unknown disse...

Grande Miojo!

Eu tava com esse mesmo problema e voce me deu a solução...

Ziba.

Contato

Email:bruno.borges(at)gmail.com

LinkedIn: www.linkedin.com/in/brunocborges
Twitter: www.twitter.com/brunoborges
Comprei e Não Vou
Rio de Janeiro, RJ Brasil
Oracle
São Paulo, SP Brasil