运行 Axis2 WSDL2Java 的 SchemaParsingConfig.setFeature() 中出现 NullPointerException

发布于 2024-07-25 22:00:21 字数 3644 浏览 2 评论 0原文

在日常工作过程中,我尝试使用本文中的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文