9 Replies Latest reply on Nov 15, 2011 8:49 AM by abdulkadir yaman

    Problem importing AbstractSoapInterceptor as OSGI reference

    abdulkadir yaman Newbie

      Hi,

      I wrote an interceptor bundle extending from org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor. And in xbean.xml i expose it like ;

       

       

       

      In another bundle which will use previous interceptor on the cxf:cxfendpoint configuration, i imported this as :

       

       

      i deploy interceptor first. It deploys perfectly, after it is deployed, i deploy the bundle which will use it, while deploying it gives me this weird exception;

      Exception in thread "SpringOsgiExtenderThread-32" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorization': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "javax/xml/stream/XMLStreamWriter"

              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)

              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1429)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:245)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:576)

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)

              at java.lang.Thread.run(Thread.java:662)

      Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "javax/xml/stream/XMLStreamWriter"

              at java.lang.Class.getDeclaredMethods0(Native Method)

              at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

              at java.lang.Class.getDeclaredMethod(Class.java:1935)

              at net.sf.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java:627)

              at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:615)

              at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:609)

              at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:631)

              at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)

              at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)

              at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)

              at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)

              at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:200)

              at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)

              at org.springframework.osgi.service.util.internal.aop.ProxyUtils$1.run(ProxyUtils.java:65)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:62)

              at org.springframework.osgi.service.util.internal.aop.ProxyUtils.createProxy(ProxyUtils.java:39)

              at org.springframework.osgi.service.importer.support.AbstractServiceProxyCreator.createServiceProxy(AbstractServiceProxyCreator.java:107)

              at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.createProxy(OsgiServiceProxyFactoryBean.java:206)

              at org.springframework.osgi.service.importer.support.AbstractServiceImporterProxyFactoryBean.getObject(AbstractServiceImporterProxyFactoryBean.java:86)

              at org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean.getObject(OsgiServiceProxyFactoryBean.java:161)

              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)

              ... 12 more

       

       

       

      My configuration is ;

      • Solaris 10

      • java 1.6

      • FUSE 4-4-1-fuse-01-06

       

      Thank you

        • 1. Re: Problem importing AbstractSoapInterceptor as OSGI reference
          Freeman(Yue) Fang Master

          Hi,

           

          Looks like you init multiple copy of stax-api from different classloader, first you need ensure your bundles didn't embed any jar(especially the stax-api), if you didn't embed jars, could you post the osgi:headers of your bundle?

           

          Freeman

          • 3. Re: Problem importing AbstractSoapInterceptor as OSGI reference
            abdulkadir yaman Newbie

            Hi Freeman,

             

            Thanks for your help. I do not wrap nor embed dependencies. I am sending headers output bundle by bundle.

             

            1.bundle, importing osgi service of SoapInterceptor ;

             

             

            Esdp Flow Manager (312)

            -


            Manifest-Version = 1

            Bnd-LastModified = 1321299705709

            Tool = Bnd-1.43.0

            Built-By = eyamabd

            Build-Jdk = 1.6.0_27

            Created-By = Apache Maven Bundle Plugin

             

             

            Bundle-Name = Esdp Flow Manager

            Bundle-SymbolicName = com.ericsson.rmea.esdp.so-esdp-flow-manager

            Bundle-Version = 0.0.0.R1A01-SNAPSHOT

            Bundle-ManifestVersion = 2

             

             

            Import-Package =

                    META-INF.cxf,

                    META-INF.cxf.osgi,

                    META-INF.cxf.transport.nmr,

                    com.ericsson.rmea.so.interceptor.authorization;version="[0.0,1)",

                    javax.jws,

                    javax.wsdl,

                    javax.xml.bind,

                    javax.xml.bind.annotation,

                    javax.xml.namespace,

                    javax.xml.parsers,

                    javax.xml.transform,

                    javax.xml.transform.dom,

                    javax.xml.transform.stream,

                    javax.xml.ws,

                    org.apache.camel;version="[2.8,3)",

                    org.apache.camel.builder;version="[2.8,3)",

                    org.apache.camel.component.cxf;version="[2.8,3)",

                    org.apache.camel.component.smpp,

                    org.apache.camel.converter.jaxp;version="[2.8,3)",

                    org.apache.camel.model;version="[2.8,3)",

                    org.apache.cxf,

                    org.apache.cxf.binding,

                    org.apache.cxf.binding.corba,

                    org.apache.cxf.binding.soap,

                    org.apache.cxf.binding.soap.interceptor,

                    org.apache.cxf.binding.soap.spring,

                    org.apache.cxf.bus,

                    org.apache.cxf.bus.resource,

                    org.apache.cxf.bus.spring,

                    org.apache.cxf.buslifecycle,

                    org.apache.cxf.catalog,

                    org.apache.cxf.configuration,

                    org.apache.cxf.configuration.spring,

                    org.apache.cxf.endpoint,

                    org.apache.cxf.headers,

                    org.apache.cxf.helpers,

                    org.apache.cxf.management,

                    org.apache.cxf.management.jmx,

                    org.apache.cxf.phase,

                    org.apache.cxf.resource,

                    org.apache.cxf.service.factory,

                    org.apache.cxf.service.model,

                    org.apache.cxf.transport,

                    org.apache.cxf.transport.http,

                    org.apache.cxf.transport.http.policy,

                    org.apache.cxf.transport.http_jetty,

                    org.apache.cxf.transport.jms,

                    org.apache.cxf.transport.servlet,

                    org.apache.cxf.transports.http,

                    org.apache.cxf.workqueue,

                    org.apache.cxf.wsdl,

                    org.apache.cxf.wsdl11,

                    org.apache.log4j,

                    org.apache.servicemix.camel.nmr,

                    org.apache.servicemix.common.osgi,

                    org.apache.servicemix.cxf.transport.nmr,

                    org.apache.servicemix.nmr.api;version="[1.4,2)",

                    org.apache.servicemix.nmr.api.event;version="[1.4,2)",

                    org.apache.servicemix.nmr.api.internal;version="[1.4,2)",

                    org.apache.servicemix.nmr.core.util;version="[1.4,2)",

                    org.apache.ws.security.action,

                    org.apache.ws.security.processor,

                    org.jsmpp.extra,

                    org.springframework.beans.factory.config;version="[3.0,4)",

                    org.springframework.mail.javamail,

                    org.w3c.dom,

                    org.xml.sax

            Export-Package =

                    com.ericsson.esdp.sscm.ws;uses:="javax.xml.bind.annotation,javax.xml.bind,javax.xml.namespace,javax.jws,javax.xml.ws";version=0.0.0.R1A01-SNAPSHOT,

                    com.ericsson.esdp.ws;uses:="javax.xml.bind.annotation,com.ericsson.esdp.sscm.ws,javax.jws,javax.xml.ws,javax.xml.namespace,javax.xml.bind";version=0.0.0.R1A01-SNAPSHOT,

                    com.ericsson.rmea.esdp.so.flowmanager.camelrouter;

                            uses:="org.apache.camel.builder,

                                    org.apache.camel.model,

                                    org.apache.log4j,

                                    org.apache.camel,

                                    com.ericsson.rmea.esdp.so.flowmanager.processors";

                            version=0.0.0.R1A01-SNAPSHOT,

                    com.ericsson.rmea.esdp.so.flowmanager.processors;

                            uses:="org.apache.log4j,

                                    org.apache.cxf.binding.soap,

                                    org.apache.camel,

                                    org.apache.camel.component.cxf,

                                    javax.xml.parsers,

                                    javax.xml.transform.dom,

                                    org.w3c.dom,

                                    org.xml.sax,

                                    javax.xml.transform,

                                    org.apache.camel.converter.jaxp,

                                    javax.xml.transform.stream";

                            version=0.0.0.R1A01-SNAPSHOT

             

            2.bundle, exporting interceptor as Osgi service ;

             

             

            CXFiPInterceptor (311)

            ----


             

             

             

            Manifest-Version = 1

            Bnd-LastModified = 1321303072881

            Tool = Bnd-1.43.0

            Built-By = eyamabd

            Build-Jdk = 1.6.0_27

            Created-By = Apache Maven Bundle Plugin

             

             

            Bundle-Name = CXFiPInterceptor

            Bundle-SymbolicName = com.ericsson.rmea.esdp.so-ip-interceptor

            Bundle-Version = 0.0.0.R1A01-SNAPSHOT

            Bundle-ManifestVersion = 2

             

             

            Import-Package =

                    com.ericsson.rmea.esdp.so.propertypoller.bean;version="[0.0,1)",

                    javax.servlet.http;version="[2.5,3)",

                    org.apache.cxf.binding.soap,

                    org.apache.cxf.binding.soap.interceptor,

                    org.apache.cxf.interceptor,

                    org.apache.cxf.message,

                    org.apache.cxf.phase,

                    org.apache.log4j,

                    org.springframework.beans.factory.annotation;version="[3.0,4)"

            Export-Package =

                    com.ericsson.rmea.so.interceptor.authorization;

                            uses:="org.apache.log4j,

                                    org.apache.cxf.binding.soap,

                                    com.ericsson.rmea.esdp.so.propertypoller.bean,

                                    org.springframework.beans.factory.annotation,

                                    org.apache.cxf.message,

                                    org.apache.cxf.binding.soap.interceptor,

                                    org.apache.cxf.interceptor,

                                    org.apache.cxf.phase,

                                    javax.servlet.http";

                            version=0.0.0.R1A01-SNAPSHOT

             

            Thanks in advance.

             

             

            • 4. Re: Problem importing AbstractSoapInterceptor as OSGI reference
              Willem Jiang Master

              Can you using the "osgi:list |grep stax" to check if there is any multi stax API installed into the Fuse ESB ?

              • 5. Re: Problem importing AbstractSoapInterceptor as OSGI reference
                abdulkadir yaman Newbie

                Hi Njiang,

                 

                Output as follows;

                 

                karaf@root> osgi:list | grep -i stax

                Apache ServiceMix :: Specs :: Stax API 1.0 (1.8.0)

                Stax2 API (3.1.1)

                karaf@root>

                 

                I have also tried this with a fresh installed Fuse. It outputs the same and problem still exists.

                 

                And if i ever try to uninstall stax bundles above, it says "you are about to access system bundle 86, do you want to continue?".

                 

                Thanks.

                • 6. Re: Problem importing AbstractSoapInterceptor as OSGI reference
                  abdulkadir yaman Newbie

                  In a fresh installed FUse it also outputs the same;

                   

                  karaf@root> list | grep -i stax

                  Apache ServiceMix :: Specs :: Stax API 1.0 (1.8.0)

                  Stax2 API (3.1.1)

                  karaf@root>

                   

                  thanks

                  • 7. Re: Problem importing AbstractSoapInterceptor as OSGI reference
                    Freeman(Yue) Fang Master

                    Hi,

                     

                    Those two bundles here are expected.

                    Could you just post the result of

                    packages:exports |grep javax.xml.stream

                    also ensure you didn't change any configuration for fuse esb.

                    Does remove $FUSE_ESB/data folder and redeploy your bundles help here?

                     

                    Also is there any chance that you can post your customer bundle(src project) which we can build and deploy to reproduce this issue?

                     

                    Freeman

                    • 8. Re: Problem importing AbstractSoapInterceptor as OSGI reference
                      abdulkadir yaman Newbie

                      Hi Freeman,

                      Thanks for the affords.

                       

                      Output of exports is;

                       

                      karaf@root> packages:exports |grep javax.xml.stream

                           0 # javax.xml.stream; version=0.0.0      

                           0 # javax.xml.stream.events; version=0.0.0

                           0 # javax.xml.stream.util; version=0.0.0 

                          87 javax.xml.stream; version=1.0.1        

                          87 javax.xml.stream.util; version=1.0.1   

                          87 javax.xml.stream.events; version=1.0.1 

                       

                      Also i havent changed any configuration in etc/ folder. I removed data folder and start it over again, but it does not help either.

                       

                      I can not send you the whole project but i can give you teamviewer id of my laptop so you can connect and check through my development environment. This would be of course your greatness.

                       

                      Thanks in advance.

                      • 9. Re: Problem importing AbstractSoapInterceptor as OSGI reference
                        abdulkadir yaman Newbie

                        Hi Freeman,

                         

                        I think i found a workaround. I imported the package javax.xml.stream in my bundle. It has solved the problem. But I am also not sure what the problem is. Anyway, i attach the trace file while deploying the bundle.

                         

                        Thank you