users@glassfish.java.net

wsgen used as ant task

From: <glassfish_at_javadesktop.org>
Date: Fri, 24 Aug 2007 00:49:57 PDT

Hi,

I've got following ant task :

[b]<property environment="env"/>
    <path id="wslib">
      <path location="${env.GLASSFISH_HOME}/lib/appserv-jstl.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/javaee.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/webservices-rt.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/webservices-tools.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/commons-logging.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/mail.jar"/>
      <path location="${env.GLASSFISH_HOME}/lib/activation.jar"/>
      <path location="${env.JAVA_HOME}/../lib/tools.jar"/>
    </path>

    <taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen" classpathref="wslib" />

    <target name="mytarget">
       <wsgen
            classpath="${build.classes.dir}"
            sei="myClass"
            resourcedestdir="src/wsdl"
            genwsdl="true"
            keep="false"
            verbose="true"
            extension="false"
            />
    </target>[/b]

Running it leads to a :

[i]You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), or set xendorsed="true" on <wsgen>.[/i]

If I place xendorsed="true" in my wsgen or if I place required jaxb-api 2.1 api I obtain following message :

[i]command line: wsgen -classpath E:\dev\deploy\netbeans\projects\lab4\ws\business_common\build\web\WEB-INF\classes -wsdl -r E:\dev\deploy\netbeans\projects\lab4\ws\business_common\src\wsdl -verbose com.apologic.server.core.ws.common.business.WsCommonBusiness
Note: ap round: 1
Problem encountered during annotation processing;
see stacktrace below for more information.
java.lang.NullPointerException
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isSubtype(WebServiceAP.java:346)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isRemote(WebServiceAP.java:341)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:750)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java:601)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.java:573)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:491)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:306)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:109)
        at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:312)
        at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:253)
        at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
        at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
        at com.sun.tools.apt.main.Main.compile(Main.java:1102)
        at com.sun.tools.apt.main.Main.compile(Main.java:964)
        at com.sun.tools.apt.Main.processing(Main.java:95)
        at com.sun.tools.apt.Main.process(Main.java:85)
        at com.sun.tools.apt.Main.process(Main.java:67)
        at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:177)
        at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:102)
        at com.sun.tools.ws.ant.WsGen2.execute(WsGen2.java:474)
        at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:55)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:240)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:293)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
error: compilation failed, errors should have been reported

[/i]

I use glassfish v2 beta 50 and try to run it under netbeans ide (but in command line execution I obtain same nullpointer exception).
Any idea ?
thx
[Message sent by forum member 'tbls' (tbls)]

http://forums.java.net/jive/thread.jspa?messageID=232454