cxf:cxf-codegen-plugin:2.1.2:wsdl2java失败:索引2

时间:2016-04-27 17:16:44

标签: java web-services cxf wsdl2java

由于以下异常,我无法使用cxf:cxf-codegen-plugin从WSDL生成所需的源:

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java (generate-sources) on project innoclient: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java failed: Illegal character in opaque part at index 2: C:\WORK\BAG\WS\POC\innoclient/src/main/wsdl/mywsdl.wsdl -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java (generate-sources) on project innoclient: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java failed: Illegal character in opaque part at index 2: C:\WORK\WS\POC\src/main/wsdl/mywsdl.wsdl
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
        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:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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.PluginExecutionException: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java failed: Illegal character in opaque part at index 2: C:\WORK\WS\POC\src/main/wsdl/mywsdl.wsdl
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: java.lang.IllegalArgumentException: Illegal character in opaque part at index 2: C:\WORK\WS\POC\src/main/wsdl/mywsdl.wsdl
        at java.net.URI.create(URI.java:859)
        at java.net.URI.resolve(URI.java:1043)
        at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:278)
        at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:228)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        ... 20 more
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\WORK\WS\POC\src/main/wsdl/mywsdl.wsdl
        at java.net.URI$Parser.fail(URI.java:2829)
        at java.net.URI$Parser.checkChars(URI.java:3002)
        at java.net.URI$Parser.parse(URI.java:3039)
        at java.net.URI.<init>(URI.java:595)
        at java.net.URI.create(URI.java:857)
        ... 24 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/PluginExecutionException

我的WSDL的定义部分如下:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://AcmeToolKit.com/"
    xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://AcmeToolKit.com/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:types>
        <s:schema elementFormDefault="qualified"

解决此问题的任何指针都会有所帮助。

谢谢和问候, 圣

1 个答案:

答案 0 :(得分:0)

问题似乎出在路径本身上。 “ C:\ WORK \ WS \ POC \ src / main / wsdl / mywsdl.wsdl”不是有效的IRI,也就是说,该异常是关于该异常的,而不是其自身文件的内容。

如果您有类似的东西

<bindingFile>${basedir}/src/main/resources/binding.xml</bindingFile>

在您的pom.xml文件中,只需将其更改为:

<bindingFile>./src/main/resources/binding.xml</bindingFile>

可能不是最好的,但要做好工作。