5 Replies Latest reply on May 14, 2013 3:07 AM by Paul Durrand

    Problems calling SOAP Service from OSGI package

    Paul Durrand Newbie

      Hi folks,

       

      I am trying to write a Java app which runs as an OSGI bundle. It as triggered by receiving a message on an ActiveMQ queue.

       

      I am running on CENTOS 6.2 using Fuse (ServiceMix) 4.4.0.

       

      Part of my task is to make requests to a SOAP server running on another machine. I was having a lot of trouble calling the service and received the following error:

       

      "javax.xml.ws.spi.FactoryFinder$ConfigurationError:

      Provider org.apache.cxf.jaxws.spi.ProviderImpl not found"

       

      I resolved this by calling Thread.setContextClassLoader(Bus.class.getClassLoader()); which I had read about on another forum question.

       

      The very next call to get the port however throws the following exception:

       

      Exception in thread "Thread-57" java.lang.NoClassDefFoundError: Could not initialize class $Proxy92

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

              at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:588)

              at org.apache.cxf.tools.util.SOAPBindingUtil.getProxy(SOAPBindingUtil.java:89)

              at org.apache.cxf.tools.util.SOAPBindingUtil.getSoapBinding(SOAPBindingUtil.java:286)

              at org.apache.cxf.tools.util.SOAPBindingUtil.getSoapBinding(SOAPBindingUtil.java:278)

              at org.apache.cxf.binding.soap.SoapBindingFactory.createBindingInfo(SoapBindingFactory.java:627)

              at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildBinding(WSDLServiceBuilder.java:487)

              at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:349)

              at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:198)

              at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:142)

              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:382)

              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499)

              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)

              at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)

              at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)

              at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)

              at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)

              at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)

              at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)

              at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)

              at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)

              at javax.xml.ws.Service.getPort(Service.java:46)

              at au.com.company.abcd.king.King.getKing(King.java:58)

              at au.com.company.decoders.DecoderService.createADSSConnection(DecoderService.java:208)

              at au.com.company.decoders.DecoderService.run(DecoderService.java:104)

       

      The stacktrace is not giving me many clues as to what it can't initialise given the class is $Proxy92

       

      My POM File (extract) looks like this:

       

       

      Can anyone offer me any advice on why I can't call this?

       

      Many thanks.

       

      Edited by: durrandp on May 14, 2013 1:51 AM