You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Axis2 wsdl2java生成代码时抛出InvocationTargetException与NullPointerException

Axis2 wsdl2java生成Java源码时抛出空指针异常

问题详情

尝试使用Axis2(1.6.1至1.8.2版本)的wsdl2java工具从WSDL文件生成Java源码,执行命令:

.\wsdl2java.bat -uri %PATH_TO_XML% -p org.apache.axis2.axis2userguide -d adb -s -u

执行后抛出如下异常:

Using AXIS2_HOME:   D:\Documentos\Axis\axis2-1.8.2
Using JAVA_HOME:    C:\Program Files\Java\jdk1.8.0_271
Retrieving document at 'D:\Documentos\Axis\axis2-1.8.2\bin\ARIBankService.xml'.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:163)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:54)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:116)
        ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
        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.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
        ... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException: java.lang.NullPointerException
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:257)
        at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:102)
        ... 8 more
Caused by: java.lang.NullPointerException
        at org.apache.axis2.schema.SchemaCompiler.addProcessedItemsToMetaInfoHolder(SchemaCompiler.java:2332)
        at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:2152)
        at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:2031)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1158)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1088)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:998)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:605)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:573)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:376)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:268)
        at org.apache.axis2.schema.SchemaCompiler.getParentSchemaFromIncludes(SchemaCompiler.java:2993)
        at org.apache.axis2.schema.SchemaCompiler.getParentSchema(SchemaCompiler.java:2944)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:819)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:561)
        at org.apache.axis2.schema.SchemaCompiler.processElements(SchemaCompiler.java:2470)
        at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:2146)
        at org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:2031)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1158)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1088)
        at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1290)
        at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1254)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1179)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1088)
        at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1290)
        at org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1254)
        at org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1179)
        at org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1088)
        at org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:998)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:605)
        at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:573)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:376)
        at org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:248)
        ... 9 more

使用的WSDL文件为ARIBankService.xml。

期望目标

成功生成Java源码,用于调用该Web服务并将其转换为REST类型服务。


内容的提问来源于stack exchange,提问作者WaterWolf

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 14:47:24