Using cxf in two bundles cause Exception: loader constraint violation in interface itable initialization

600 views Asked by At

I use Apache CXF in some bundle A to call video from http://www.movingimage24.com/ in my Portal A. this works fine, the videos can be called from movingimage24 and displayed in my Portal A without problem.

Now when I use Apache CXF in some Bundle B on the same way like in Bundle A, and try to call the video in my portal B, the following exception is thrown:

ERROR [0:0:0:0:0:0:0:1 [1416678184971] GET /content/portal/de/home/company/test_videomanager.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Exception: loader constraint violation in interface itable initialization: when resolving method "javax.xml.bind.helpers.AbstractMarshallerImpl.setAttachmentMarshaller(Ljavax/xml/bind/attachment/AttachmentMarshaller;)V" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, javax/xml/bind/helpers/AbstractMarshallerImpl, and the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) for interface javax/xml/bind/Marshaller have different Class objects for the type javax/xml/bind/attachment/AttachmentMarshaller used in the signature java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "javax.xml.bind.helpers.AbstractMarshallerImpl.setAttachmentMarshaller (Ljavax/xml/bind/attachment/AttachmentMarshaller;)V" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, javax/xml/bind/helpers/AbstractMarshallerImpl, and the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) for interface javax/xml/bind/Marshaller have different Class objects for the type javax/xml/bind/attachment/AttachmentMarshaller used in the signature

at com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:776)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.createMarshaller(JAXBContextImpl.java:142)
at org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:120)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:212)
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:114)
at org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor.handleMessage(RPCOutInterceptor.java:94)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:565)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)
at de.company.acd.company.cq.webservice.OsgiAwareClientImpl.invoke(OsgiAwareClientImpl.java:62)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
at $Proxy139.getHttpsPlayerCodeForLockedVideo(Unknown Source)
...
...........
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:249)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.felix.http.proxy.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.sling.launchpad.base.webapp.SlingServletDelegate.service(SlingServletDelegate.java:277)
at org.apache.sling.launchpad.webapp.SlingServlet.service(SlingServlet.java:150)
at com.day.j2ee.servletengine.ServletRuntimeEnvironment.service(ServletRuntimeEnvironment.java:228)
at com.day.j2ee.servletengine.RequestDispatcherImpl.doFilter(RequestDispatcherImpl.java:315)
at com.day.j2ee.servletengine.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at com.day.crx.launchpad.filters.CRXLaunchpadLicenseFilter.doFilter(CRXLaunchpadLicenseFilter.java:96)
at com.day.j2ee.servletengine.FilterChainImpl.doFilter(FilterChainImpl.java:72)
at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:334)
at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:378)
at com.day.j2ee.servletengine.ServletHandlerImpl.execute(ServletHandlerImpl.java:315)
at com.day.j2ee.servletengine.DefaultThreadPool$DequeueThread.run(DefaultThreadPool.java:134)
at java.lang.Thread.run(Thread.java:662)

my pom.xml for bundle B looks like this:

> >   <plugins>
>          <plugin>
>             <groupId>org.apache.cxf</groupId>
>             <artifactId>cxf-codegen-plugin</artifactId>
>             <version>${apache.cxf.version}</version>
>             <executions>
>                <execution>
>                   <id>generate-sources</id>
>                   <phase>generate-sources</phase>
>                   <configuration>
>                      <defaultOptions>
>                         <autoNameResolution>true</autoNameResolution>
>                      </defaultOptions>
>                      <sourceRoot>${project.build.directory}/cxf-generated</sourceRoot>
>                      <extension>true</extension>
>                      <wsdlOptions>
>                         <wsdlOption>
>                            <wsdl>${basedir}/src/main/resources/wsdl/VideoManager/VideoManager.wsdl</wsdl>
>                         </wsdlOption>
>                      </wsdlOptions>
>                      <sources>
>                         <source>${project.build.directory}/cxf-generated</source>
>                      </sources>
>                   </configuration>
>                   <goals>
>                      <goal>wsdl2java</goal>
>                   </goals>
>                </execution>
>             </executions>
>          </plugin>        <plugin>
>             <groupId>org.apache.felix</groupId>
>             <artifactId>maven-bundle-plugin</artifactId>
>             <extensions>true</extensions>
>             <version>2.3.7</version>
>             <configuration>
>                <instructions>
>                   <Import-Package>
>                      javax.activation;version=1.1.0,
>                      javax.xml.bind.*;
>                      com.adobe.xmp,
>                      org.apache.cxf.jaxb.*;
>                      com.day.commons.datasource.poolservice,
>                      com.day.cq.commons.jcr,
>                      com.day.cq.dam.api,
>                      com.day.cq.dam.commons.metadata,
>                      com.day.cq.dam.commons.process,
>                      com.day.cq.dam.core,
>                      com.day.cq.jcrclustersupport,
>                      com.day.cq.replication,
>                      com.day.cq.search,
>                      com.day.cq.search.result,
>                      com.day.cq.security,
>                      com.day.cq.wcm.api,
>                      com.day.cq.wcm.api.components,
>                      com.day.cq.wcm.api.designer,
>                      com.day.cq.wcm.foundation,
>                      com.day.cq.workflow,
>                      com.day.cq.workflow.exec,
>                      com.day.cq.workflow.model,
>                      com.day.cq.workflow.metadata,
>                      com.day.text,
>                      javax.crypto,
>                      javax.crypto.spec,
>                      javax.imageio,
>                      javax.imageio.metadata,
>                      javax.imageio.stream,
>                      javax.jcr,
>                      javax.jcr.nodetype,
>                      javax.jcr.query,
>                      javax.jcr.lock,
>                      javax.jcr.version,
>                      javax.jws,
>                      javax.jws.soap,
>                      javax.servlet,
>                      javax.servlet.http,
>                      javax.sql,
>                      javax.xml.bind,
>                      javax.xml.bind.annotation,
>                      javax.xml.bind.annotation.adapters,
>                      javax.xml.datatype,
>                      javax.xml.namespace,
>                      javax.xml.parsers,
>                      javax.xml.transform,
>                      javax.xml.transform.stream,
>                      javax.xml.ws,
>                      com.day.cq.commons,
>                      org.apache.commons.codec,
>                      org.apache.commons.codec.binary,
>                      org.apache.commons.codec.net,
>                      org.apache.commons.collections,
>                      org.apache.commons.dbutils,
>                      org.apache.commons.dbutils.handlers,
>                      org.apache.commons.httpclient,
>                      org.apache.commons.httpclient.auth,
>                      org.apache.commons.httpclient.methods,
>                      org.apache.commons.httpclient.params,
>                      org.apache.commons.lang,
>                      org.apache.commons.lang.builder,
>                      org.apache.commons.lang.time,
>                      org.apache.commons.logging,
>                      org.apache.sling.api,
>                      org.apache.sling.api.request,
>                      org.apache.sling.api.resource,
>                      org.apache.sling.api.scripting,
>                      org.apache.sling.api.servlets,
>                      org.apache.sling.commons.json,
>                      org.apache.sling.commons.json.io,
>                      org.apache.sling.event.*,
>                      org.apache.sling.jcr.api,
>                      org.apache.sling.jcr.resource,
>                      org.apache.sling.settings,
>                      org.jdom,
>                      org.jdom.output,
>                      org.jdom.input,
>                      org.osgi.framework,
>                      org.osgi.service.component,
>                      org.osgi.service.cm,
>                      org.slf4j,
>                      org.w3c.dom,
>                      org.xml.sax,
>                      org.xml.sax.helpers,
>                      *;resolution:=optional
>                   </Import-Package>
>                   <Embed-Dependency>
>                      cxf-bundle;inline=true,
>                      jaxb-api,
>                      jaxb-xjc,
>                      jaxb-impl,
>                      jaxb-core,
>                      velocity;groupId=org.apache.velocity;artifactId=velocity;scope=compile,
>                      activation;version=1.1,
>                      xmlschema-core,
>                      spring-beans,
>                      spring-core,
>                      neethi,
>                      wsdl4j,
>                     </Embed-Dependency>
>                   
>                   <!-- CXF Dependencies -->
>            <dependencies>      <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-frontend-jaxws</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-transports-http</artifactId>
>          <version>${apache.cxf.version}</version>
>          <scope>compile</scope>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-frontend-simple</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-core</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-api</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-bindings-soap</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.ws.xmlschema</groupId>
>          <artifactId>xmlschema-core</artifactId>
>          <version>2.0.3</version>
>       </dependency>
>       <dependency>
>          <groupId>org.springframework</groupId>
>          <artifactId>spring-beans</artifactId>
>          <version>3.0.6.RELEASE</version>
>       </dependency>
>       <dependency>
>          <groupId>org.springframework</groupId>
>          <artifactId>spring-core</artifactId>
>          <version>3.0.6.RELEASE</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.neethi</groupId>
>          <artifactId>neethi</artifactId>
>          <version>3.0.1</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-databinding-jaxb</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>wsdl4j</groupId>
>          <artifactId>wsdl4j</artifactId>
>          <version>1.6.2</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-tools-common</artifactId>
>          <version>${apache.cxf.version}</version>
>          <exclusions>
>             <exclusion>
>                <groupId>commons-lang</groupId>
>                <artifactId>commons-lang</artifactId>
>             </exclusion>
>          </exclusions>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.cxf</groupId>
>          <artifactId>cxf-rt-ws-addr</artifactId>
>          <version>${apache.cxf.version}</version>
>       </dependency>    </dependencies>

I am new to Apache CXF and hope somebody can help me.

0

There are 0 answers