java.lang.LinkageError:加载器约束违规:加载器(org / apache / felix / framework / ModuleImpl $ ModuleClassLoaderJava5的实例)

时间:2014-11-23 15:13:27

标签: maven cxf apache-felix cxf-codegen-plugin

当我尝试将我的软件包部署到felix console / CQ crx时,我收到以下错误:

  

引起:java.lang.LinkageError:加载器约束违规:加载器(org / apache / felix / framework / ModuleImpl $ ModuleClassLoaderJava5的实例)以前为名称为#34; javax / xml / bind的其他类型启动加载/附接/ AttachmentMarshaller"       at java.lang.ClassLoader.defineClass1(Native Method)       在java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)       at java.lang.ClassLoader.defineClass(ClassLoader.java:615)       at org.apache.felix.framework.ModuleImpl $ ModuleClassLoader.findClass(ModuleImpl.java:1907)       在org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:727)       在org.apache.felix.framework.ModuleImpl.access $ 400(ModuleImpl.java:71)       at org.apache.felix.framework.ModuleImpl $ ModuleClassLoader.loadClass(ModuleImpl.java:1768)       at java.lang.ClassLoader.loadClass(ClassLoader.java:247)       在org.apache.cxf.jaxb.JAXBDataBinding.createWriter(JAXBDataBinding.java:271)       at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.getDataWriter(AbstractOutDatabindingInterceptor.java:178)       at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:109)       at org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor.handleMessage(RPCOutInterceptor.java:94)       在org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)       在org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:565)       在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)       at de..webservices.utils.OsgiAwareClientImpl.invoke(OsgiAwareClientImpl.java:62)       在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377)       在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330)       at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)       在org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)       在$ Proxy139.getHttpsPlayerCodeForLockedVideo(未知来源)       at de.webservices.videoplayer.impl.VideoManagerServiceImpl.getHttpsPlayerCodeForLockedVideo(VideoplayerImpl.java:123)       at de.components.videoplayer.player.init(Videoplayer.java:36)       at de.AbstractComponent.setSlingRequest(AbstractComponent.java:90)       ...... 228更多

这是我的pom.xml文件:

> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>...</groupId>
      ..
   </parent>
   <artifactId>...</artifactId>
   <packaging>bundle</packaging>
 <name>${artifactId}</name>
   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
   <build>
      <finalName>${project.artifactId}</finalName>
      <plugins>
         <!-- Apache CXF wsdl2java source generation -->
         <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.build.version}</version>

            <executions>
               <execution>
                  <id>generate-sources</id>
                  <phase>generate-sources</phase>
                  <configuration>
                     <defaultOptions>
                        <autoNameResolution>true</autoNameResolution>
                     </defaultOptions>
                     <encoding>${project.build.sourceEncoding}</encoding>
                     <sourceRoot>${project.build.directory}/generated</sourceRoot>
                     <extension>true</extension>
                     <wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
                     <wsdlOptions>
                        <wsdlOption>
                           <wsdl>${basedir}/src/main/resources/wsdl/service.wsdl</wsdl>
                        </wsdlOption>
                     </wsdlOptions>
                     <sources>
                        <source>${project.build.directory}/generated</source>
                     </sources>

                  </configuration>
                  <goals>
                     <goal>wsdl2java</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
               <execution>
                  <id>add-wsdl-source</id>
                  <phase>generate-sources</phase>
                  <goals>
                     <goal>add-source</goal>
                  </goals>
                  <configuration>
                     <sources>
                        <source>${project.build.directory}/generated</source>
                     </sources>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <artifactId>maven-scr-plugin</artifactId>
            <groupId>org.apache.felix</groupId>
         </plugin>
         <plugin>
            <artifactId>maven-sling-plugin</artifactId>
            <groupId>org.apache.sling</groupId>
         </plugin>
         <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
               <instructions>
                  <Export-Package>
                        <!-- cxf-bundle-2.7.8.jar -->
                     org.apache.cxf.jaxrs.ext;version=${cxf.version},
                     <!-- geronimo-jaxws_2.2_spec-1.1.jar -->
                     javax.xml.ws.*;version=2.2.8,
                     <!-- geronimo-jms_1.1_spec -->
                     javax.jms.*;version=1.1,
                     <!-- javax.ws.rs-api-2.0-m10.jar -->
                     javax.ws.rs.*;version=2.0-m10,
                     <!-- jaxb-api-version.jar -->
                     javax.xml.bind.*;version=${jaxb.api.version},
                     <!-- neethi-3.0.2.jar -->
                     org.apache.neethi.*;version=3.0.2,
                     <!-- jsr181-api-1.0-MR1.jar -->
                     javax.jws.*;version=1.0.0,
                     <!-- serializer-2.7.1.jar -->
                     org.apache.xml.serializer.*;version=2.7.1,
                     <!-- stax2-api-3.1.1.jar -->
                     org.codehaus.stax2.*;version=3.1.1,
                     <!-- woodstox-core-asl-4.2.0.jar -->
                     com.ctc.wstx.*;version=4.2.0,
                     <!-- wsdl4j-1.6.3.jar -->
                     javax.wsdl.*;version=${wsdl4j.version},
                     <!-- wss4j-1.6.13.jar -->
                     org.apache.ws.security.*;version=${cxf.version},
                     <!-- xmlschema-core-2.0.3.jar -->
                     org.apache.ws.commons.schema.*,
                     <!-- xmlsec-1.5.6.jar -->
                     javax.xml.crypto.*;version=1.5.6,
                     org.apache.xml.security.*;version=1.5.6,
                  </Export-Package>
                  <Embed-Dependency>
                     cxf-bundle;inline=true,
                     geronimo-jaxws_2.2_spec,
                     geronimo-jms_1.1_spec,
                     javax.ws.rs-api-2.0-m10,
                     neethi,
                     serializer,
                     stax2-api,
                     woodstox-core-asl,
                     wsdl4j,
                     wss4j,
                     xmlschema-core,
                     xmlsec,
                     jsr181-api,
                     spring-beans,
                     spring-context,
                     spring-core,
                     spring-jms,
                     spring-tx,
                     xmltooling,
                     jaxb-api,
                     jaxb-xjc,
                     <!-- XML-Parsing javax.xml.bind.ContextFinder -->
                     jaxb-impl,
                     jaxb-core,
                     FastInfoset,
                     stax-ex,
                  </Embed-Dependency>
                  <Embed-Transitive>true</Embed-Transitive>
                  <Import-Package>
                     javax.activation;version=1.1.0,
                     <!-- don't import javax.mail or subpackages, otherwise javax.activation
                        will be taken from the wrong bundle (instead of the system bundle) -->
                     !org.relaxng.datatype.*,
                     !javax.xml.crypto.*,
                     !org.apache.xml.security.*,
                     !org.kohsuke.rngom.*,
                     !org.apache.xml.serializer.*,
                     !org.codehaus.stax2.*,
                     !com.ctc.wstx.*,
                     !org.apache.neethi.*,
                     !javax.xml.ws.*,
                     !com.sun.xml.bind.*,
                     !com.sun.istack.*,
                     !com.sun.xml.txw2.*,
                     !com.sun.xml.dtdparser.*,
                     !com.sun.xml.xsom.*,
                     !org.apache.cxf.*,
                     !org.apache.ws.*,
                     !com.sun.codemodel.*,
                     !com.sun.tools.xjc.*,
                     !javax.wsdl.*,
                     !javax.ws.rs.*,
                     !javax.xml.bind.*,
                     !javax.jws.*,
                     <!--include everything else (only optional) -->
                     *;resolution:=optional;version=0.0.0
                  </Import-Package>
               </instructions>
            </configuration>
         </plugin>

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <source>1.6</source>
               <target>1.6</target>
               <encoding>${file.encoding}</encoding>
            </configuration>
         </plugin>
      </plugins>
   </build>

   <profiles>
....
  </profiles>

   <dependencies>

      <!-- OSGI related -->

      <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.core</artifactId>
      </dependency>

      <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.compendium</artifactId>
      </dependency>

      <!-- Felix -->

      <!-- <dependency> -->
      <!-- <groupId>org.osgi</groupId> -->
      <!-- <artifactId>osgi_R4_core</artifactId> -->
      <!-- <version>1.0</version> -->
      <!-- <scope>provided</scope> -->
      <!-- </dependency> -->

      <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.scr.annotations</artifactId>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
      </dependency>

      <dependency>
         <groupId>org.apache.ws.security</groupId>
         <artifactId>wss4j</artifactId>
      </dependency>

      <dependency>
         <groupId>org.apache.neethi</groupId>
         <artifactId>neethi</artifactId>
         <version>3.0.2</version>
         <exclusions>
            <exclusion>
               <!-- provided by cxf -->
               <groupId>org.codehaus.woodstox</groupId>
               <artifactId>woodstox-core-asl</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.11</version>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-bundle</artifactId>
         <version>${cxf.version}</version>
         <scope>compile</scope>
         <exclusions>
            <exclusion>
               <!-- provides javax.servlet that is a system library -->
               <groupId>org.apache.geronimo.specs</groupId>
               <artifactId>geronimo-servlet_3.0_spec</artifactId>
            </exclusion>
            <exclusion>
               <!-- provides jaxb-xjc in version 2.1.13 -->
               <groupId>com.sun.xml.bind</groupId>
               <artifactId>jaxb-xjc</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>com.sun.xml.bind</groupId>
         <artifactId>jaxb-impl</artifactId>
         <version>${jaxb.impl.version}</version>
      </dependency>
      <dependency>
         <groupId>com.sun.xml.bind</groupId>
         <artifactId>jaxb-xjc</artifactId>
         <version>${jaxb.impl.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-jaxws_2.2_spec</artifactId>
         <version>1.1</version>
         <scope>compile</scope>
      </dependency>

      <dependency>
         <groupId>xalan</groupId>
         <artifactId>serializer</artifactId>
         <exclusions>
            <exclusion>
               <groupId>xml-apis</groupId>
               <artifactId>xml-apis</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>commons-lang</groupId>
         <artifactId>commons-lang</artifactId>
         <type>bundle</type>
      </dependency>

      <dependency>
         <groupId>javax.jws</groupId>
         <artifactId>jsr181-api</artifactId>
         <version>1.0-MR1</version>
      </dependency>

      <dependency>
         <groupId>org.jvnet.staxex</groupId>
         <artifactId>stax-ex</artifactId>
         <version>1.7</version>
         <exclusions>
            <exclusion>
               <!-- Bundle uses system lib -->
               <groupId>javax.activation</groupId>
               <artifactId>activation</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
   </dependencies>

</project>

0 个答案:

没有答案