3 Replies Latest reply on Dec 3, 2013 12:38 PM by Jeremy Whiting

    Classloader visibility to WS extensions SoapBody interface.

    Jeremy Whiting Expert

      Hi,

      I am running a JEE application with a number of components including MDB and Web Services. Using Byteman I've discovered an exception is being thrown when the application is running.

      The exception is thrown during execution of a an MDB static block. In the static block a ThreadLocal field is being assigned a reference to a ws javax.xml.ws.Service.

       

      This is some of the code

       

      public class PurchaseOrderMDB implements MessageListener {

      static  {

        synchronized(BuyerMDB.class){

            ss = new ThreadLocal<SupplierPortType>() {

                @Override

                public SupplierPortType initialValue() {

                    QName serviceName =

                            new QName("org:acme:acme:ws:supplier",

                            "SupplierService");

                    URL url = BuyerMDB.class.getClassLoader().

                            getResource(wsdlLocation);

                    Service s = Service.create(url, serviceName);

      line 107:             return s.getPort(SupplierPortType.class);

                }

            };

        }

      }

      ........

       

       

      This is the exception message

       

      1385973473950 *** Throwable created with this message [interface org.apache.cxf.binding.soap.wsdl.extensions.SoapBody is not visible from class loader] ***

      java.lang.Throwable.<init>(Throwable.java:197)

      java.lang.Exception.<init>(Exception.java:66)

      java.lang.RuntimeException.<init>(RuntimeException.java:62)

      java.lang.IllegalArgumentException.<init>(IllegalArgumentException.java:53)

      java.lang.reflect.Proxy.getProxyClass0(Proxy.java:487)

      java.lang.reflect.Proxy.newProxyInstance(Proxy.java:722)

      org.apache.cxf.binding.soap.SOAPBindingUtil.getProxy(SOAPBindingUtil.java:89)

      org.apache.cxf.binding.soap.SOAPBindingUtil.getSoapBody(SOAPBindingUtil.java:195)

      org.apache.cxf.binding.soap.SOAPBindingUtil.getSoapBody(SOAPBindingUtil.java:186)

      org.apache.cxf.binding.soap.SoapBindingFactory.initializeMessage(SoapBindingFactory.java:760)

      org.apache.cxf.binding.soap.SoapBindingFactory.initializeBindingOperation(SoapBindingFactory.java:710)

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

      org.apache.cxf.wsdl11.WSDLServiceBuilder.buildBinding(WSDLServiceBuilder.java:486)

      org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:354)

      org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:203)

      org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:175)

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

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

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

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

      org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:450)

      org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:515)

      org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:327)

      org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:322)

      javax.xml.ws.Service.getPort(Service.java:168)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB$1.initialValue(PurchaseOrderMDB.java:107)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB$1.initialValue(PurchaseOrderMDB.java:98)

      java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:160)

      java.lang.ThreadLocal.get(ThreadLocal.java:150)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB.getPort(PurchaseOrderMDB.java:301)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB.sendInlinePO(PurchaseOrderMDB.java:205)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB.sendPO(PurchaseOrderMDB.java:163)

      org.acme.acme.ejb.supplier.mdb.PurchaseOrderMDB.onMessage(PurchaseOrderMDB.java:127)

      sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)

      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      java.lang.reflect.Method.invoke(Method.java:606)

      org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:49)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:250)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:341)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:238)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:203)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

      org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)

      javax.jms.MessageListener$$$view11.onMessage (Unknown Source)

      sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)

      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      java.lang.reflect.Method.invoke(Method.java:606)

      org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140)

      org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)

      com.sun.proxy.$Proxy102.onMessage (Unknown Source)

      org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:328)

      org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1117)

      org.hornetq.core.client.impl.ClientConsumerImpl.access$500(ClientConsumerImpl.java:57)

      org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1252)

      org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:107)

      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      java.lang.Thread.run(Thread.java:744)

       

      The whole application is deployed in an EAR archive. The PurchaseOrderMDB and BuyerMDB is in a JAR archive and the Supplier Web Service in a separate JAR archive in the lib sub directory of the same EAR archive.

       

      My question is shouldn't the ws extensions interface that is being loaded by the PurchaseMDB be accessible or do I need to configure the class loader explicitly ?

       

      Regards,

      Jeremy