2016-10-07 9 views
0

Я пытаюсь преобразовать WSDL в Java с использованием Maven и CxF-Codegen-плагина, но я всегда получаю ту же ошибку:NoClassDefFoundError при использовании CxF-Codegen-плагина с мавенный

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.1.6:wsdl2java (aspsms) on project webapp: org/apache/velocity/context/Context: org.apache.velocity.context.Context -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.1.6:wsdl2java (aspsms) on project webapp: org/apache/velocity/context/Context 
    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) 
Caused by: org.apache.maven.plugin.MojoExecutionException: org/apache/velocity/context/Context 
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:435) 
    at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:260) 
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:512) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    ... 20 more 
Caused by: java.lang.NoClassDefFoundError: org/apache/velocity/context/Context 
    at org.apache.cxf.tools.wsdlto.core.AbstractGenerator.<init>(AbstractGenerator.java:47) 
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.AbstractJAXWSGenerator.<init>(AbstractJAXWSGenerator.java:30) 
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.AntGenerator.<init>(AntGenerator.java:44) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
    at java.lang.Class.newInstance(Class.java:442) 
    at org.apache.cxf.tools.wsdlto.core.PluginLoader.getFrontEndGenerators(PluginLoader.java:278) 
    at org.apache.cxf.tools.wsdlto.core.PluginLoader.getFrontEndProfile(PluginLoader.java:393) 
    at org.apache.cxf.tools.wsdlto.WSDLToJava.loadFrontEnd(WSDLToJava.java:64) 
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:96) 
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86) 
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:415) 
    ... 24 more 
Caused by: java.lang.ClassNotFoundException: org.apache.velocity.context.Context 
    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) 
    ... 38 more 
[ERROR] 
[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 

Моей МВН версии:

$ mvn -version 
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) 
Maven home: /Users/user/Desktop/dev/ses/apps/apache-maven-3.3.9 
Java version: 1.8.0_101, vendor: Oracle Corporation 
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre 
Default locale: fr_FR, platform encoding: UTF-8 
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac" 

Вот мой П файл:

 <plugin> 
      <groupId>org.apache.cxf</groupId> 
      <artifactId>cxf-codegen-plugin</artifactId> 
      <version>3.1.6</version> 
      <executions> 
       <execution> 
        <id>aspsms</id> 
        <phase>generate-sources</phase> 
        <configuration> 
         <sourceRoot>${basedir}/src/main/generated-source</sourceRoot> 
         <wsdlOptions> 
          <wsdlOption> 
           <wsdl>${basedir}/src/wsdl/aspsmsx2.wsdl</wsdl> 
           <extraargs> 
            <extraarg>-p</extraarg> 
            <extraarg>com.test.service.adapter.aspsms.wsclient</extraarg> 
           </extraargs> 
          </wsdlOption> 
         </wsdlOptions> 
        </configuration> 
        <goals> 
         <goal>wsdl2java</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

файлы фляга были правильно загружены в моем Maven репо. У вас есть совет?

+0

Может быть, это рабочий пример поможет: http://stackoverflow.com/a/40158135/3779152 – nean

ответ

0

Может быть, вы можете добавить в явном виде зависимость к скорости в конфигурации плагина

<plugin> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-codegen-plugin</artifactId> 
     <version>3.1.6</version> 
     <executions> 
      <execution> 
       <id>aspsms</id> 
       <phase>generate-sources</phase> 
       <configuration> 
        <sourceRoot>${basedir}/src/main/generated-source</sourceRoot> 
        <wsdlOptions> 
         <wsdlOption> 
          <wsdl>${basedir}/src/wsdl/aspsmsx2.wsdl</wsdl> 
          <extraargs> 
           <extraarg>-p</extraarg> 
           <extraarg>com.test.service.adapter.aspsms.wsclient</extraarg> 
          </extraargs> 
         </wsdlOption> 
        </wsdlOptions> 
       </configuration> 
       <goals> 
        <goal>wsdl2java</goal> 
       </goals> 
      </execution> 
     </executions> 
     <dependencies> 
       <dependency> 
        <groupId>org.apache.velocity</groupId> 
        <artifactId>velocity</artifactId> 
        <version>1.7</version> 
       </dependency> 
      </dependencies> 
    </plugin> 
+0

я уже пробовал. Это не работает – jobe

 Смежные вопросы

  • Нет связанных вопросов^_^