1

I have a ws client created using maven with artifact maven-jaxws-tools-plugin and goal wsconsume.

Once I try to initiate the client I am having below error.

03:25:03,928 ERROR [org.quartz.core.JobRunShell] (quartzScheduler_Worker-1) Job DEFAULT.rcdLogTrackerJobDetail threw an unhandled Exception: : java.lang.NoClassDefFoundError: org/springframework/beans/BeansException
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54)
        at org.jboss.wsf.stack.cxf.client.ProviderImpl.setValidThreadDefaultBus(ProviderImpl.java:213)
        at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:140)
        at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
       .....
        at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:]
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @4f2c61fe (roots: /opt/extcomp/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.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 14 more

03:25:03,949 ERROR [org.quartz.core.ErrorLogger] (quartzScheduler_Worker-1) Job (DEFAULT.rcdLogTrackerJobDetail threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NoClassDefFoundError: org/springframework/beans/BeansException]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:234) [quartz-1.8.6.jar:]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:]
Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/BeansException
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54)
        at org.jboss.wsf.stack.cxf.client.ProviderImpl.setValidThreadDefaultBus(ProviderImpl.java:213)
        at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:140)
        at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
       .....
        at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113) [spring-context-support-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:]
        ... 1 more
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @4f2c61fe (roots: /opt/extcomp/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.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 14 more

I did some search and see that there is a bug of JBoss 7.1.1 and can be fixed just by doing some manual stuff like; creating a new module and adding it to apache cxf module etc..

I did all these stuff. But couldn't get it working.

Can someone help me, If I am doing something wrong.

by the way; since the client has been created using wsconsume, I also tried to add the module dependency (spring module created by me) to jboss cxf stuff as well. But not worked.

Olgun Kaya
  • 2,519
  • 4
  • 32
  • 46

4 Answers4

3

I think I found the issue. It was a typo on my manually-created spring module.

I am not sure if we need to consider this as answer but the issue was a typo.

The solution I followed was.

http://blog.brunoborges.com.br/2012/06/jboss-711-and-cxf-ws-client.html

and of course you need to use correct jar versions while following the above guide.

Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117
Olgun Kaya
  • 2,519
  • 4
  • 32
  • 46
3

The post indicated by @Olgum is realy good and help me. But, the link to module.xml is broken. So in order to preserve it for future, I'll post the solution below.

  1. On the jboss-as-7.1.1-Final folder ([JBOSS_HOME]), create this path: modules/org/springframework/spring/main
  2. Create the module.xml file (below) inside the newly created folder
  3. Download and put the jar files into the same folder (the list of jar is inside the module.xml)
  4. Open this file [JBOSS_HOME]/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" />

Spring module.xml content:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
    <resources>
        <resource-root path="spring-aop-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-asm-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-beans-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-context-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-context-support-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-core-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-expression-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-jdbc-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-orm-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-oxm-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-tx-3.1.4.RELEASE.jar"/>
        <resource-root path="spring-web-3.1.4.RELEASE.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.jms.api"/>
        <module name="javax.annotation.api"/>
        <module name="javax.servlet.api"/>
        <module name="org.apache.commons.logging"/>
        <module name="org.jboss.vfs"/>
    </dependencies>
</module>
Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117
Bob Rivers
  • 5,261
  • 6
  • 47
  • 59
0

I had the same error when instantiating a webservice client, but I couldn't change the JBoss modules (corporate environment). This issue took my day but I finally solved it by adding a dependency to cxf-rt-frontend-jaxws version 2.7.4.

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
</dependency>

Hope it helps.

Juljan
  • 802
  • 2
  • 8
  • 13
0

Julian's solution got me going in the right direction, but there were still missing dependencies which were resolved by looking at this solution:

Apache CXF Exception: java.lang.RuntimeException: Could not find conduit initiator for address

Therefore, I added the following to my pom:

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-jetty</artifactId>
        <version>${cxf.version}</version>
    </dependency>
candlebar
  • 81
  • 3