2 Replies Latest reply on Mar 15, 2012 5:33 AM by Luigi Oneto

    jboss ws cxf client istantiated from a spring context without spring libraries in common/lib

    Luigi Oneto Newbie

      Hi all, I am a newbie in jboss ws

       

      I am developing a "headless" jboss/web application which is loaded and started by means of a spring application context;

      which in turn is loaded by a spring ContextLoaderListener configured in the web.xml;

       

      the application connects to external devices and communicates with remote applications using web services (client and service);

      the spring libraries are not deployed in the common/lib directory (Jboss-6.1.0-Final)

       

      when instantiating the client proxy to a remote web service,

      I receive a (well known) exception thrown during the execution of the the javax.xml.ws.Service constructor:

       

      java.lang.NoClassDefFoundError: org/springframework/beans/BeansException

      at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)

       

      the exception in due to the missing spring jars in the common/lib directory, while the spring libraries are available in the current thread context classpath.

       

      After examination of the classes

       

      org.jboss.wsf.stack.cxf.client.ProviderImpl and

      org.jboss.wsf.stack.cxf.client.configuration.JbossWSBusFactory,

       

      I inserted the following code, before the invocation of the javax.xml.ws.Service constructor (through an extending class):

       

          BusFactory busFactory = BusFactory.newInstance();

          if (busFactory instanceof JBossWSBusFactory)

                  BusFactory.setThreadDefaultBus(((JBossWSBusFactory)busFactory).getNonSpringBusFactory().createBus());

         

           MyService service = new MyService(..

       

      where MyService extends javax.xml.ws.Service.

       

      and now the service client is istantiated ok.

       

      Required (provided scope) jars in the compilation classpath,

      from directory %JBOSS_HOME%/ client:

        cxf-api.jar, cxf-rt-core.jar, jbossws-cxf-client.jar

       

      My question:

      can the same result be achieved with modification of the jboss ws cxf ... configuration files ?

       

      thanks to all,

      Luigi