2014-04-24 87 views
1

我在離線方案中對Maven使用wsdl2java工具和cxf-codegen-plugin。 我有一個罐子Types.jar包括使用jaxb2-maven-plugin轉換爲java類的常用XML Schemata。我正在使用OASIS xml目錄來引用常見模式的本地副本,例如XMLDSIG-核心schema.xsd。這工作到目前爲止。CXF wsdl2java未解析目錄

我也有一個WebService.jar它由WSDL和XSD倒錯,其中進口從圖式Types.jar的。

當運行Maven構建,我得到以下錯誤:

Loading FrontEnd jaxws ... 
Loading DataBinding jaxb ... 
wsdl2java -encoding UTF-8 -d C:\path\to\my\project\src\generated\java -b classpath:/xsd/Types.xjb -b classpath:/xsd/simpleBinding.schemalet -xjc-verbose -xjc-encoding -xjcUTF-8 -xjc- 
catalog -xjcC:/path/to/my/catalog.cat -catalog C:/path/to/my/catalog.cat -p http://ws.myws.com/Test=com.myws.ws.test -verbose -wsdlLocation wsdl/MYWSDL.wsdl file:/C:/path/to/my/MYWSDL.wsdl 
wsdl2java - Apache CXF 2.7.11 

[DEBUG] 
org.apache.cxf.tools.common.ToolException: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition file:/C:/path/to/my/MYWSDL.wsdl 
_SOAP.wsdl: WSDLException (at /wsdl:definitions/wsdl:types/schema/xs:schema/xs:schema/schema): faultCode=PARSER_ERROR: Problem parsing 'jar:file:/C:/Users/me/.m2/repository/path/to/my/types.jar!/xsd/xmldsig-core-schema.xsd'.: java.net.UnknownHostException: www.w3.org 
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:420) 
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103) 
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113) 
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86) 
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:427) 
    at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:311) 
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:524) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    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:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    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:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition file:/C:/path/to/my/MYWSDL.wsdl_SOAP.wsdl: WSDLException (at /w 
sdl:definitions/wsdl:types/schema/xs:schema/xs:schema/schema): faultCode=PARSER_ERROR: Problem parsing 'jar:file:/C:/Users/me/.m2/repository/path/to/my/types.jar!/xsd/xmldsig-core-schema.xsd'.: java.net.UnknownHostException: www.w3.org 
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:97) 
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.build(WSDLDefinitionBuilder.java:69) 
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:82) 
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:59) 
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:198) 
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164) 
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412) 
    ... 27 more 
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/schema/xs:schema/xs:schema/schema): faultCode=PARSER_ERROR: Problem parsing 'jar:file:/C:/Users/me/.m2/repository/path/to/my/types.jar!/xsd/xmldsig-core-schema.xsd'.: java.net.UnknownHostException: www.w3.org 
    at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:830) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:864) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:864) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:864) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:654) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:610) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:320) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2338) 
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:261) 
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206) 
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:78) 
    ... 33 more 
Caused by: java.net.UnknownHostException: www.w3.org 
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) 
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
    at java.net.Socket.connect(Socket.java:579) 
    at java.net.Socket.connect(Socket.java:528) 
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180) 
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) 
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) 
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) 
    at sun.net.www.http.HttpClient.New(HttpClient.java:308) 
    at sun.net.www.http.HttpClient.New(HttpClient.java:326) 
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996) 
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932) 
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850) 
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300) 
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) 
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) 
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source) 
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) 
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source) 
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) 
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) 
    at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188) 
    ... 45 more 

我catalog.cat看起來是這樣的:

SYSTEM "http://www.w3.org/2001/xml.xsd" "classpath:/xsd/xml.xsd" 
PUBLIC "http://www.w3.org/2001/XMLSchema" "classpath:/xsd/xml.xsd" 
PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "classpath:/xsd/XMLSchema.dtd" 
SYSTEM "http://www.w3.org/2001/XMLSchema.dtd" "classpath:/xsd/XMLSchema.dtd" 

我嘗試CXF 2.7.6和2.7.11,我嘗試了XML目錄格式,我甚至將所有參考Schema複製到WebService.jar而沒有在目錄中的類路徑:表達式,所有這些表達式都具有相同的結果和錯誤消息。

看來目錄信息在某處丟失。

任何想法?

+0

你可以請你的pom.xml的插件配置? –

回答

0

(是的,我晚了兩年,但是)我相信這是由wsdl4j bug 34引起的錯誤CXF-1505

因此:那些catalog.cat條目可能沒問題(儘管您還需要一個用於datatypes.dtd的引用XMLSchema.dtd),但由於這些錯誤,它們最終被忽略。

一種解決方法,儘管比較gr,,但要修改xsd/xmldsig-core-schema.xsd資源,以便不是指「http://www.w3.org/2001/XMLSchema.dtd」,而是指同一目錄中的「XMLSchema.dtd」將datatypes.dtd的副本放在該目錄中)。