2016-02-15 422 views
5

我正在尋找一個用於創建(wsgen)和導入(wsimport)web服務到我的項目的maven插件,但似乎沒有人使用JDK 8,因此我無法編譯我的整個項目都是以JDK 8爲基礎的。JAX-WS Maven插件不能用於JDK 8

的,其原因是已經在JDK 8被刪除AnnotationProcessorFactory類...

這裏是我的POM:

<parent> 
    <groupId>com.something.project</groupId> 
    <artifactId>some-service</artifactId> 
    <version>0.8-001-SNAPSHOT</version> 
</parent> 

<artifactId>some-ejb</artifactId> 
<version>0.8-001-SNAPSHOT</version> 
<packaging>ejb</packaging> 
<name>some-ejb</name> 
..... Some Dependency 
    <build> 
    <plugins> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
       <compilerArguments> 
        <endorseddirs>${endorsed.dir}</endorseddirs> 
       </compilerArguments> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-ejb-plugin</artifactId> 
      <version>2.3</version> 
      <configuration> 
       <ejbVersion>3.1</ejbVersion> 
      </configuration> 
     </plugin> 

    </plugins> 
</build> 

<profiles> 
    <profile> 
     <id>gen-local-ws</id> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.jvnet.jax-ws-commons</groupId> 
        <artifactId>jaxws-maven-plugin</artifactId> 
        <version>2.2</version> 
        <executions> 
         <execution> 
          <id>ExposedInquiryService</id> 
          <goals> 
           <goal>wsgen</goal> 
          </goals> 
          <configuration> 
           <sei>com.behin.inquiry.exposed.ExposedInquiryService</sei> 
           <genWsdl>true</genWsdl> 
           <encoding>UTF-8</encoding> 
           <keep>false</keep> 
           <inlineSchemas>true</inlineSchemas> 
           <verbose>true</verbose> 
           <resourceDestDir>${wsdl.target-dir}</resourceDestDir> 
          </configuration> 
         </execution> 
        </executions> 
        <dependencies> 
         <dependency> 
          <groupId>com.sun.xml.ws</groupId> 
          <artifactId>jaxws-tools</artifactId> 
          <version>2.2.5</version> 
         </dependency> 
         <dependency> 
          <groupId>org.glassfish.extras</groupId> 
          <artifactId>glassfish-embedded-all</artifactId> 
          <version>3.1.1</version> 
         </dependency> 


         <dependency> 
          <groupId>log4j</groupId> 
          <artifactId>log4j</artifactId> 
          <version>1.2.17</version> 
         </dependency> 
        </dependencies> 

       </plugin> 
      </plugins> 
     </build> 
    </profile> 
</profiles> 

這裏是正常的異常:

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ project-ejb --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 4 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ project-ejb --- 
[INFO] Compiling 108 source files to /home/mehdi/Projects/project/ramon-project-app/trunk/project-parent/project-service/project-ejb/target/classes 
[INFO] 
[INFO] --- jaxws-maven-plugin:2.2:wsgen (ExposedprojectService) @ project-ejb --- 
[WARNING] '-encoding' is not supported by jaxws-tools:2.2.5 
[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] project-parent ..................................... SUCCESS [ 0.652 s] 
[INFO] project-common ..................................... SUCCESS [ 2.412 s] 
[INFO] project-service .................................... SUCCESS [ 0.009 s] 
[INFO] project-entities ................................... SUCCESS [ 2.268 s] 
[INFO] project-ejb ........................................ FAILURE [ 2.960 s] 
[INFO] project-ear ........................................ SKIPPED 
[INFO] project-desktop-app ................................ SKIPPED 
[INFO] project-web-services-local ......................... SKIPPED 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 8.483 s 
[INFO] Finished at: 2016-02-14T16:21:19+03:30 
[INFO] Final Memory: 59M/508M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen (ExposedprojectService) on project project-ejb: Failed to execute wsgen: com/sun/mirror/apt/AnnotationProcessorFactory: com.sun.mirror.apt.AnnotationProcessorFactory -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :project-ejb 

Process finished with exit code 1 

這是mvn clean安裝後的異常-U

[WARNING] '-encoding' is not supported by jaxws-tools:2.2.5 
[DEBUG] jaxws:wsgen args: [-d, /home/mehdi/Projects/project/ramon-project-app/trunk/project-parent/project-service/project-ejb/target/classes, -verbose, -cp, /home/mehdi/Projects/project/ramon-project-app/trunk/project-parent/project-service/project-ejb/target/classes:/home/mehdi/Projects/project/ramon-project-app/trunk/project-parent/project-service/project-entities/target/project-entities-0.8-001-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/p10pc/afis-entities/0.8-001-SNAPSHOT/afis-entities-0.8-001-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/p10pc/p10pc-afis/0.8-001-SNAPSHOT/p10pc-afis-0.8-001-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/afis/grid/grid.ws/2.0.2-SNAPSHOT/grid.ws-2.0.2-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/ramon/biometrics/fingerprint-engine/1.3.0-SNAPSHOT/fingerprint-engine-1.3.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/org/apache/directory/studio/org.apache.commons.codec/1.6/org.apache.commons.codec-1.6.jar:/home/mehdi/.m2/repository/org/eclipse/persistence/eclipselink/2.3.2/eclipselink-2.3.2.jar:/home/mehdi/.m2/repository/org/eclipse/persistence/javax.persistence/2.0.3/javax.persistence-2.0.3.jar:/home/mehdi/.m2/repository/com/something/afis/common-security/0.8-004-SNAPSHOT/common-security-0.8-004-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/ramon/web-services-ext/1.3.0-SNAPSHOT/web-services-ext-1.3.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/common/common-business-objects/0.8-020-SNAPSHOT/common-business-objects-0.8-020-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/afis/biometric-objects/0.8-002-SNAPSHOT/biometric-objects-0.8-002-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/ramon/image-capture/1.2.0-SNAPSHOT/image-capture-1.2.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:/home/mehdi/.m2/repository/org/jvnet/com4j/com4j/20110320/com4j-20110320.jar:/home/mehdi/.m2/repository/com/something/ramon/biometrics/fingerprint-graphics-model/0.8-003-SNAPSHOT/fingerprint-graphics-model-0.8-003-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/afis/something-ij/1.49-SNAPSHOT/something-ij-1.49-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/something/p10pc/p10pc-ws-local/0.8-001-SNAPSHOT/p10pc-ws-local-0.8-001-SNAPSHOT.jar:/home/mehdi/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar:/home/mehdi/.m2/repository/com/ibm/icu/icu4j/4.0.1/icu4j-4.0.1.jar:/home/mehdi/.m2/repository/com/something/persiancalendar/something-persianCalendar/2.1-SNAPSHOT/something-persianCalendar-2.1-SNAPSHOT.jar:/home/mehdi/.m2/repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar:/home/mehdi/.m2/repository/com/something/ramon/biometrics/biometrics-format/1.5.13-SNAPSHOT/biometrics-format-1.5.13-SNAPSHOT.jar:/home/mehdi/.m2/repository/com/netflix/servo/servo-core/0.8.0/servo-core-0.8.0.jar:/home/mehdi/.m2/repository/com/netflix/servo/servo-internal/0.8.0/servo-internal-0.8.0.jar:/home/mehdi/.m2/repository/com/google/guava/guava/14.0.1/guava-14.0.1.jar:/home/mehdi/.m2/repository/com/google/code/findbugs/annotations/2.0.0/annotations-2.0.0.jar:/home/mehdi/.m2/repository/com/something/ramon/ramon-common/1.2.0-SNAPSHOT/ramon-common-1.2.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/javax/javaee-api/6.0/javaee-api-6.0.jar:/home/mehdi/.m2/repository/com/something/afis/civil-web-services-local/0.8-001-SNAPSHOT/civil-web-services-local-0.8-001-SNAPSHOT.jar:/home/mehdi/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/home/mehdi/.m2/repository/com/something/ramon/upload-common/1.0-SNAPSHOT/upload-common-1.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/home/mehdi/.m2/repository/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar:/home/mehdi/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/mehdi/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/mehdi/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar:/home/mehdi/.m2/repository/com/something/iris/iris-engine/1.0.0-SNAPSHOT/iris-engine-1.0.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar:/home/mehdi/.m2/repository/com/something/integrity/project-iris-web-service-local/1.0-SNAPSHOT/project-iris-web-service-local-1.0-SNAPSHOT.jar:/home/mehdi/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/home/mehdi/.m2/repository/org/jvnet/jax-ws-commons/jaxws-maven-plugin/2.2/jaxws-maven-plugin-2.2.jar:/home/mehdi/.m2/repository/com/sun/xml/ws/jaxws-tools/2.2.5/jaxws-tools-2.2.5.jar:/home/mehdi/.m2/repository/com/sun/xml/ws/jaxws-rt/2.2.5/jaxws-rt-2.2.5.jar:/home/mehdi/.m2/repository/javax/xml/ws/jaxws-api/2.2.5/jaxws-api-2.2.5.jar:/home/mehdi/.m2/repository/javax/xml/bind/jaxb-api/2.2.3/jaxb-api-2.2.3.jar:/home/mehdi/.m2/repository/javax/xml/soap/saaj-api/1.3.3/saaj-api-1.3.3.jar:/home/mehdi/.m2/repository/org/glassfish/javax.annotation/3.1.1-b06/javax.annotation-3.1.1-b06.jar:/home/mehdi/.m2/repository/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar:/home/mehdi/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.4-1/jaxb-impl-2.2.4-1.jar:/home/mehdi/.m2/repository/com/sun/xml/messaging/saaj/saaj-impl/1.3.10/saaj-impl-1.3.10.jar:/home/mehdi/.m2/repository/com/sun/xml/stream/buffer/streambuffer/1.2/streambuffer-1.2.jar:/home/mehdi/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/home/mehdi/.m2/repository/org/codehaus/woodstox/woodstox-core-asl/4.1.1/woodstox-core-asl-4.1.1.jar:/home/mehdi/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/home/mehdi/.m2/repository/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar:/home/mehdi/.m2/repository/org/jvnet/staxex/stax-ex/1.4/stax-ex-1.4.jar:/home/mehdi/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar:/home/mehdi/.m2/repository/org/jvnet/mimepull/1.6/mimepull-1.6.jar:/home/mehdi/.m2/repository/com/sun/xml/ws/policy/2.2.2/policy-2.2.2.jar:/home/mehdi/.m2/repository/com/sun/xml/txw2/txw2/20090102/txw2-20090102.jar:/home/mehdi/.m2/repository/com/sun/istack/istack-commons-runtime/2.2.1/istack-commons-runtime-2.2.1.jar:/home/mehdi/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.3/wstx-asl-3.2.3.jar:/home/mehdi/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/mehdi/.m2/repository/org/glassfish/gmbal/gmbal-api-only/3.1.0-b001/gmbal-api-only-3.1.0-b001.jar:/home/mehdi/.m2/repository/org/glassfish/external/management-api/3.0.0-b012/management-api-3.0.0-b012.jar:/home/mehdi/.m2/repository/org/glassfish/ha/ha-api/3.1.8/ha-api-3.1.8.jar:/home/mehdi/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.4-1/jaxb-xjc-2.2.4-1.jar:/home/mehdi/.m2/repository/org/glassfish/extras/glassfish-embedded-all/3.1.1/glassfish-embedded-all-3.1.1.jar:/home/mehdi/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/home/mehdi/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-basics/0.6.3/jaxb2-basics-0.6.3.jar:/home/mehdi/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-basics-runtime/0.6.3/jaxb2-basics-runtime-0.6.3.jar:/home/mehdi/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-basics-tools/0.6.3/jaxb2-basics-tools-0.6.3.jar:/home/mehdi/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/mehdi/.m2/repository/commons-lang/commons-lang/2.2/commons-lang-2.2.jar:/home/mehdi/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.jar:/home/mehdi/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.jar:/home/mehdi/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.jar:/home/mehdi/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar:/home/mehdi/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/mehdi/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar:/home/mehdi/.m2/repository/org/apache/maven/maven-plugin-api/2.2.1/maven-plugin-api-2.2.1.jar:/home/mehdi/.m2/repository/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.jar:/home/mehdi/Downloads/jdk1.8.0_74/jre/../lib/tools.jar, -wsdl, -inlineSchemas, -r, /home/mehdi/Projects/project/ramon-project-app/trunk/project-parent/project-service/project-ejb/target/generated-sources/wsdl, com.something.project.exposed.ExposedprojectService] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] project-parent ..................................... SUCCESS [ 0.305 s] 
[INFO] project-common ..................................... SUCCESS [ 2.574 s] 
[INFO] project-service .................................... SUCCESS [ 0.005 s] 
[INFO] project-entities ................................... SUCCESS [ 2.180 s] 
[INFO] project-ejb ........................................ FAILURE [ 2.509 s] 
[INFO] project-ear ........................................ SKIPPED 
[INFO] project-desktop-app ................................ SKIPPED 
[INFO] project-web-services-local ......................... SKIPPED 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 7.762 s 
[INFO] Finished at: 2016-02-14T16:24:12+03:30 
[INFO] Final Memory: 59M/506M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen (ExposedprojectService) on project project-ejb: Failed to execute wsgen: com/sun/mirror/apt/AnnotationProcessorFactory: com.sun.mirror.apt.AnnotationProcessorFactory -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen (ExposedprojectService) on project project-ejb: Failed to execute wsgen 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to execute wsgen 
    at org.jvnet.jax_ws_commons.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:148) 
    at org.jvnet.jax_ws_commons.jaxws.MainWsGenMojo.execute(MainWsGenMojo.java:95) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    ... 26 more 
Caused by: java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401) 
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) 
    at com.sun.tools.ws.WsGen.doMain(WsGen.java:74) 
    at org.jvnet.jax_ws_commons.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:142) 
    ... 29 more 
Caused by: java.lang.ClassNotFoundException: com.sun.mirror.apt.AnnotationProcessorFactory 
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) 
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) 
    ... 45 more 
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :project-ejb 

Process finished with exit code 1 

我們該如何解決這個問題?

回答

6

我能夠用虛擬WebService類重現您的問題。

這是因爲您在插件依賴關係中使用了jaxws-tools的廢棄版本。您應該升級到2.2.10的最新版本,而不是2.2.5。

<dependency> 
    <groupId>com.sun.xml.ws</groupId> 
    <artifactId>jaxws-tools</artifactId> 
    <version>2.2.10</version> 
</dependency> 

作爲一個側面說明,你也應該考慮更新到的jaxws-maven-plugin 2.3版本,這是目前最新的。

+1

工作!謝謝〜 – Mehdi

-1

您使用的是哪個JAX-WS版本2.0或更高版本?我讀了某處對註釋處理API的更改,並建議您將JAX-WS版本升級到2.10.x以解決問題。

找到它 - here是公告 - 在1.7中被廢棄並在1.8中被刪除。建議升級JAX-WS版本以解決問題。

+0

我用過org.jvnet.jax-ws-commons 2.3.1-b20150201.1248版本和org.codehaus.mojo 2.4.1版本,它們都沒有工作 – Mehdi

+0

你需要maven解決方案 - 快速谷歌提示幾個解決方法,因爲這個已經被報告檢查https://netbeans.org/bugzilla/show_bug.cgi?id=241570和http://stackoverflow.com/questions/23814921/cannot-use-org-jvnet-jax-ws-commons-jaxws- maven-plugin-on-jdk8 –

+0

請檢查異常情況,您發送的鏈接是不同的故事,當我想使用wsgen而不是wsimport時遇到此問題。我甚至無法生成wsdl ... – Mehdi