使用wsdl2java.bat生成java代码报错
首先,各位大家好这个应该是我在CSDN的易做图贴吧,哎,虽然注册很久了,但是还是第一次发帖,进入正题:
现在想学习 使用 Axis2和tomcat7.0构建webservice,在eclipse中构建工程,用tomcat将服务启动以后,得到wsdl,uri为:http://127.0.0.1:8080/Axis2Service2/services/AxisService?wsdl,成功得到wsdl文件。
然后我又想用Axis2调用webservice,用wsdl2java.bat生成javacode,然后写客户端进行调用的,
我将eclipse Axis2以及tomcat全部压缩装在了 F 盘
再window下使用指令生成java code的时候报错如下,还望大家能帮忙解决下是什么原因。
使用指令如下:
wsdl2java -uri http://127.0.0.1:8080/Axis2Service2/services/AxisService?wsdl -p ws -s -o stub
---------------------------------------------------------------------------------------------
F:\>cd axis2-1.5.4-bin
F:\axis2-1.5.4-bin>cd axis2-1.5.4
F:\axis2-1.5.4-bin\axis2-1.5.4>cd bin
F:\axis2-1.5.4-bin\axis2-1.5.4\bin>wsdl2java -uri http://127.0.0.1:8080/Axis2Ser
vice2/services/AxisService?wsdl -p ws -s -o stub
Using AXIS2_HOME: F:\axis2-1.5.4-bin\axis2-1.5.4
Using JAVA_HOME: C:\Program Files\Java\jdk1.6.0_45
Retrieving document at 'http://127.0.0.1:8080/Axis2Service2/services/AxisService
?wsdl'.
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(CodeGener
ationEngine.java:271)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExcepti
on
at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp
leDBExtension.java:53)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
ationEngine.java:224)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp
leDBExtension.java:50)
... 3 more
Caused by: org.apache.axis2.schema.SchemaCompilationException: java.io.IOExcepti
on: Root location needs to be a directory!
at org.apache.axis2.schema.writer.JavaBeanWriter.init(JavaBeanWriter.jav
a:216)
at org.apache.axis2.schema.SchemaCompiler.<init>(SchemaCompiler.java:211
)
at org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java
:101)
... 8 more
Caused by: java.io.IOException: Root location needs to be a directory!
at org.apache.axis2.schema.writer.JavaBeanWriter.initWithFile(JavaBeanWr
iter.java:333)
at org.apache.axis2.schema.writer.JavaBeanWriter.init(JavaBeanWriter.jav
a:169)
... 10 more
F:\axis2-1.5.4-bin\axis2-1.5.4\bin>
这是第一次发帖,不知道是不是要分,我木有分哦~~不知道分能用来干啥,就是知道有分能够下载csdn一些需要的文件。还望大家能帮忙解答下。
再次谢谢大家。
wsdl webservice java --------------------编程问答-------------------- 为什么没人回答我的问题呢?好伤心~~~~,自己给自己顶下~~ --------------------编程问答-------------------- 用浏览器查看wsdl,贴出来 --------------------编程问答-------------------- 呵呵,已经解决了,
F:\axis2-1.5.4-bin\axis2-1.5.4\bin>wsdl2java -uri http://127.0.0.1:8080/Axis2Ser
vice2/services/AxisService?wsdl -p ws -s -o F:\stub 就可以了~谢谢你的回复~~
补充:Java , Java EE