运行 Axis2 WSDL2Java 的 SchemaParsingConfig.setFeature() 中出现 NullPointerException
在日常工作过程中,我尝试使用本文中的 WSDL 和 XSD:
http://www.ibm.com/developerworks/webservices/library/ws-restwsdl/
作为模板,从中生成一些 java 代码。 我的愿望是使用生成的 java 代码以某种方式验证我的(将要)手工制作的 WSDL 和模式是否合理。 问题是,当我运行(类似)时:
...WSDL2Java --noBuildXML --unpack-classes -uri booklist.wsdl -wv 2.0
我得到这个异常:
[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:159)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
[java] Caused by: java.lang.NullPointerException
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.setFeature(Unknown Source)
[java] at org.apache.xerces.parsers.BasicParserConfiguration.<init>(BasicParserConfiguration.java:261)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:340)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:347)
[java] at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(XMLSchemaValidator.java:1086)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.configurePipeline(StandardParserConfiguration.java:673)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.reset(StandardParserConfiguration.java:627)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:502)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
[java] at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
[java] at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:221)
[java] at org.apache.woden.internal.DOMWSDLReader.getDocument(DOMWSDLReader.java:735)
[java] at org.apache.woden.internal.DOMWSDLReader.retrieveSchema(DOMWSDLReader.java:629)
[java] at org.apache.woden.internal.DOMWSDLReader.parseSchemaImport(DOMWSDLReader.java:380)
[java] at org.apache.woden.internal.BaseWSDLReader.parseTypes(BaseWSDLReader.java:573)
[java] at org.apache.woden.internal.BaseWSDLReader.parseDescription(BaseWSDLReader.java:429)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:185)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:158)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1225)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1176)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.<init>(WSDL20ToAxisServiceBuilder.java:153)
[java] at org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder.<init>(WSDL20ToAllAxisServicesBuilder.java:53)
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:102)
[java] ... 2 more
我不能从仅位于当前目录中的文件生成代码吗? (我之前已经这样做过,但它是一个 WSDL 1.1 文件,没有外部支持模式文件)
此示例 WSDL 是否存在已知问题?
Axis2(版本 1.5)WSDL2Java 中是否存在错误? (显然,最好有关于某些丢失数据的错误消息,而不是抛出空指针/引用)
In the process of my daily work, I am trying to use the WSDL and XSD from this article:
http://www.ibm.com/developerworks/webservices/library/ws-restwsdl/
as a template from which to generate some java code. My desire is to use the generated java code to in some way validate that my (to be) hand-rolled WSDL and schema are reasonably sane. Problem is, when I run (something like):
...WSDL2Java --noBuildXML --unpack-classes -uri booklist.wsdl -wv 2.0
I get this exception:
[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:159)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
[java] Caused by: java.lang.NullPointerException
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.setFeature(Unknown Source)
[java] at org.apache.xerces.parsers.BasicParserConfiguration.<init>(BasicParserConfiguration.java:261)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:340)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:347)
[java] at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(XMLSchemaValidator.java:1086)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.configurePipeline(StandardParserConfiguration.java:673)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.reset(StandardParserConfiguration.java:627)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:502)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
[java] at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
[java] at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:221)
[java] at org.apache.woden.internal.DOMWSDLReader.getDocument(DOMWSDLReader.java:735)
[java] at org.apache.woden.internal.DOMWSDLReader.retrieveSchema(DOMWSDLReader.java:629)
[java] at org.apache.woden.internal.DOMWSDLReader.parseSchemaImport(DOMWSDLReader.java:380)
[java] at org.apache.woden.internal.BaseWSDLReader.parseTypes(BaseWSDLReader.java:573)
[java] at org.apache.woden.internal.BaseWSDLReader.parseDescription(BaseWSDLReader.java:429)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:185)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:158)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1225)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1176)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.<init>(WSDL20ToAxisServiceBuilder.java:153)
[java] at org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder.<init>(WSDL20ToAllAxisServicesBuilder.java:53)
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:102)
[java] ... 2 more
Can I not generate the code from files merely sitting in the current directory? (I have done this before, but it was a WSDL 1.1 file which did not have external supporting schema files)
Is there a known problem with this example WSDL?
Is there a bug in Axis2 (version 1.5) WSDL2Java? (obviously, it would be nice to have an error message about some missing data, instead of the null pointer/reference throw up)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论