使用ant脚本生成wsdl

时间:2013-09-09 18:20:43

标签: java ant wsdl

我需要使用ant脚本

生成Axis Web服务wsdl

这是我从教程页面获得的脚本 - 但它不起作用,我无法弄清楚它有什么问题

<target name="main" depends="create-class-dir, create-wsgen-outdir, create-wsdl-outdir,compile">
    <exec executable="${wsgen-cmd}">
        <arg value="-verbose" />
        <!-- Set the classpath. -->
        <arg value="-cp" />
        <arg value="${class-dir}" />
        <!-- Generate a WSDL file. -->
        <arg value="-wsdl" />
        <!-- Specify where to write other generated files. -->
        <arg value="-d" />
        <arg value="${wsgen-outdir}" />
        <!-- Specify where to write WSDL and XML schema files. -->
        <arg value="-r" />
        <arg value="${wsdl-outdir}" />
        <!-- Specify where to write generated source files. -->
        <arg value="-s" />
        <arg value="${src-outdir}" />
        <!-- Keep generated source files. -->
        <arg value="-keep" />
        <!-- Specify service endpoint interface/class. -->
        <arg value="com.lenabru.webservice.ElectronicArenaWebService" />
    </exec>
</target>

但是它失败了

[exec] Note:       ap round: 2
[exec] Exception in thread "main" java.lang.NoClassDefFoundError: Lorg/json/JSONObject;
[exec]     at java.lang.Class.getDeclaredFields0(Native Method)
[exec]     at java.lang.Class.privateGetDeclaredFields(Class.java:2387)

我的类路径中有一个java-json.jar - 但它似乎无法识别它,我该如何判断它在哪里?

编辑:

C:\Dev\webworkspace\ElectronicArenaLenasProject>ant main
Buildfile: C:\Dev\webworkspace\ElectronicArenaLenasProject\build.xml
     [echo] calling the web services generation task wsgen C:\Dev\webworkspace\ElectronicArenaLenasProject/build/classes/

create-class-dir:

create-wsgen-outdir:

create-wsdl-outdir:

compile:
     [echo] lib dir is C:\Dev\webworkspace\ElectronicArenaLenasProject/WebContent/WEB-INF/lib
    [javac] Compiling 37 source files to C:\Dev\webworkspace\ElectronicArenaLenasProject\build\classes

main:
     [exec]
     [exec] warning: The apt tool and its associated API are planned to be
     [exec] removed in the next major JDK release.  These features have been
     [exec] superseded by javac and the standardized annotation processing API,
     [exec] javax.annotation.processing and javax.lang.model.  Users are
     [exec] recommended to migrate to the annotation processing features of
     [exec] javac; see the javac man page for more information.
     [exec] Note:       ap round: 1
     [exec] [ProcessedMethods Class: com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [should process method: user hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: user()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.User]
     [exec] [should process method: uli hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: uli()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.Uli]
     [exec] [should process method: item hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: item()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.Item]
     [exec] [should process method: category hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: category()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.Category]
     [exec] [should process method: order hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: order()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.Order]
     [exec] [should process method: memberRegister hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: memberRegister(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.
,java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.MemberRegister]
     [exec] [should process method: memberLogin hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: memberLogin(java.lang.String,java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.MemberLogin]
     [exec] [should process method: getAllUsers hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: getAllUsers()]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.GetAllUsers]
     [exec] [should process method: userNameUnique hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: userNameUnique(java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.UserNameUnique]
     [exec] [should process method: memberLogout hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: memberLogout(java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.MemberLogout]
     [exec] [should process method: updateMember hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: updateMember(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,jav
ng,java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.UpdateMember]
     [exec] [should process method: deleteMember hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: deleteMember(java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.DeleteMember]
     [exec] [should process method: addNewItem hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: addNewItem(java.lang.String,java.lang.String,java.lang.String,int,double,java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.AddNewItem]
     [exec] [should process method: getItem hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: getItem(long)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.GetItem]
     [exec] [should process method: getItemsBySeller hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: getItemsBySeller(long)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.GetItemsBySeller]
     [exec] [should process method: updateItem hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: updateItem(long,java.lang.String,java.lang.String,java.lang.String,long,double)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.UpdateItem]
     [exec] [should process method: addCategory hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: addCategory(java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.AddCategory]
     [exec] [should process method: removeCategory hasWebMethods: true ]
     [exec] [endpointReferencesInterface: false]
     [exec] [declaring class has WebSevice: true]
     [exec] [returning: true]
     [exec] [WrapperGen - method: removeCategory(java.lang.String)]
     [exec] [method.getDeclaringType(): com.lenabru.webservice.ElectronicArenaWebService]
     [exec] [requestWrapper: com.lenabru.webservice.jaxws.RemoveCategory]
     [exec] [ProcessedMethods Class: java.lang.Object]
     [exec] com\lenabru\webservice\jaxws\AddCategory.java
     [exec] com\lenabru\webservice\jaxws\AddCategoryResponse.java
     [exec] com\lenabru\webservice\jaxws\AddNewItem.java
     [exec] com\lenabru\webservice\jaxws\AddNewItemResponse.java
     [exec] com\lenabru\webservice\jaxws\Category.java
     [exec] com\lenabru\webservice\jaxws\CategoryResponse.java
     [exec] com\lenabru\webservice\jaxws\DeleteMember.java
     [exec] com\lenabru\webservice\jaxws\DeleteMemberResponse.java
     [exec] com\lenabru\webservice\jaxws\GetAllUsers.java
     [exec] com\lenabru\webservice\jaxws\GetAllUsersResponse.java
     [exec] com\lenabru\webservice\jaxws\GetItem.java
     [exec] com\lenabru\webservice\jaxws\GetItemResponse.java
     [exec] com\lenabru\webservice\jaxws\GetItemsBySeller.java
     [exec] com\lenabru\webservice\jaxws\GetItemsBySellerResponse.java
     [exec] com\lenabru\webservice\jaxws\Item.java
     [exec] com\lenabru\webservice\jaxws\ItemResponse.java
     [exec] com\lenabru\webservice\jaxws\MemberLogin.java
     [exec] com\lenabru\webservice\jaxws\MemberLoginResponse.java
     [exec] com\lenabru\webservice\jaxws\MemberLogout.java
     [exec] com\lenabru\webservice\jaxws\MemberLogoutResponse.java
     [exec] com\lenabru\webservice\jaxws\MemberRegister.java
     [exec] com\lenabru\webservice\jaxws\MemberRegisterResponse.java
     [exec] com\lenabru\webservice\jaxws\Order.java
     [exec] com\lenabru\webservice\jaxws\OrderResponse.java
     [exec] com\lenabru\webservice\jaxws\RemoveCategory.java
     [exec] com\lenabru\webservice\jaxws\RemoveCategoryResponse.java
     [exec] com\lenabru\webservice\jaxws\Uli.java
     [exec] com\lenabru\webservice\jaxws\UliResponse.java
     [exec] com\lenabru\webservice\jaxws\UpdateItem.java
     [exec] com\lenabru\webservice\jaxws\UpdateItemResponse.java
     [exec] com\lenabru\webservice\jaxws\UpdateMember.java
     [exec] com\lenabru\webservice\jaxws\UpdateMemberResponse.java
     [exec] com\lenabru\webservice\jaxws\User.java
     [exec] com\lenabru\webservice\jaxws\UserNameUnique.java
     [exec] com\lenabru\webservice\jaxws\UserNameUniqueResponse.java
     [exec] com\lenabru\webservice\jaxws\UserResponse.java
     [exec] Note:       ap round: 2
     [exec] Exception in thread "main" java.lang.NoClassDefFoundError: Lorg/json/JSONObject;
     [exec]     at java.lang.Class.getDeclaredFields0(Native Method)
     [exec]     at java.lang.Class.privateGetDeclaredFields(Class.java:2387)
     [exec]     at java.lang.Class.getDeclaredFields(Class.java:1796)
     [exec]     at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:264)
     [exec]     at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:47)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:365)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:296)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:171)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:232)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:89)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getBaseClass(ClassInfoImpl.java:213)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:140)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:71)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:247)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:89)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:198)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:84)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:313)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:81)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:58)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:47)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:40)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:63)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:61)
     [exec]     at java.util.AbstractList$Itr.next(AbstractList.java:358)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:244)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:89)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:198)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:84)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:313)
     [exec]     at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:328)
     [exec]     at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:445)
     [exec]     at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:283)
     [exec]     at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:126)
     [exec]     at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148)
     [exec]     at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:173)
     [exec]     at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:96)
     [exec]     at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:98)
     [exec]     at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:151)
     [exec]     at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:143)
     [exec]     at java.security.AccessController.doPrivileged(Native Method)
     [exec]     at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:143)
     [exec]     at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:84)
     [exec]     at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:235)
     [exec]     at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:232)
     [exec]     at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:111)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [exec]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [exec]     at java.lang.reflect.Method.invoke(Method.java:606)
     [exec]     at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:120)
     [exec]     at com.sun.tools.internal.ws.WsGen.main(WsGen.java:42)
     [exec] Caused by: java.lang.ClassNotFoundException: org.json.JSONObject
     [exec]     at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
     [exec]     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
     [exec]     at java.security.AccessController.doPrivileged(Native Method)
     [exec]     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
     [exec]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     [exec]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     [exec]     ... 57 more
     [exec] Result: 1
   [delete] Deleting directory C:\Dev\webworkspace\ElectronicArenaLenasProject\build\wsgen-output\com

0 个答案:

没有答案