You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gene Chuang <ge...@yahoo.com> on 2002/12/30 00:35:33 UTC

axis ant task in netbeans

I'm relatively new to Web services, ANT and NetBeans (although an old hat to J2EE, make and vi), so I figure I learn all 3 simultaneously for my prototype project.

I can run java2wsdI manually from the commandline, but I cannot get the java2wsdl ant task to run properly under netbeans.  This is what I've done:

1)  put axis-ant.jar in NETBEANS_HOME/lib
2)  added the following entry to build.xml:
  <target description="java2wsdl">
    <axis-java2wsdl classname="${my_service}" location="${my_url}"/>
  </target>

When I build this target, I get "Could not create task or type of type: axis-java2wsdl".  So next I tried adding the following 

3) added at beginning of build.xml:
  <taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"/>

Now I get "taskdef class org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask cannot be found".  Help!  Am I placing axis-ant.jar in the wrong place?  Or is my build.xml syntax horribly wrong?  Thanks!

Gene

 

Re: axis ant task in netbeans

Posted by Gene Chuang <ge...@yahoo.com>.
Yup, I switched to <java> to invoke all the axis tools and my problems are gone...  Found out even the StackOverflowException I reported was directly caused by:
<taskdef classpathref="axis.classpath" resource="axis-tasks.properties"/>
This tag causes the overflow even if I'm invoking a target that does not use an axis-task.  I will stop beta-testing the axis tasks until they are proven more stable :-)
Gene
 Michael Rimov <ri...@centercomp.com> wrote:At 02:28 PM 1/2/2003 -0800, you wrote:

> >Well, ant does its thing differently; you can't really align the 
> codebase that well
>
>Given that axis standalone commandlines (WSDL2Java, Java2WSDL and Admin) 
>are more stable and better supported than their ant-task counterparts, 
>would it be simply better (or possible) for me to write 's that 
>invoke of the former java programs rather than trying to run the 
>axis ant-tasks?

Sure,

I did that myself, and it works fantastic. Been doing that since RC-1.

HTH!
-Mike


Re: axis ant task in netbeans

Posted by Michael Rimov <ri...@centercomp.com>.
At 02:28 PM 1/2/2003 -0800, you wrote:

> >Well, ant does its thing differently; you can't really align the 
> codebase that well
>
>Given that axis standalone commandlines (WSDL2Java, Java2WSDL and Admin) 
>are more stable and better supported than their ant-task counterparts, 
>would it be simply better (or possible) for me to write <target>'s that 
>invoke <exec> of the former java programs rather than trying to run the 
>axis ant-tasks?

Sure,

I did that myself, and it works fantastic.  Been doing that since RC-1.

HTH!
                                                         -Mike



Re: axis ant task in netbeans

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Gene Chuang" <ge...@yahoo.com>
To: <ax...@xml.apache.org>
Sent: Thursday, January 02, 2003 14:28
Subject: Re: axis ant task in netbeans


>
> Thanks for all your valuable input Steve.
> >Well, ant does its thing differently; you can't really align the codebase
that well
> Given that axis standalone commandlines (WSDL2Java, Java2WSDL and Admin)
are more stable and better supported than their ant-task counterparts, would
it be simply better (or possible) for me to write <target>'s that invoke
<exec> of the former java programs rather than trying to run the axis
ant-tasks?

no need to <exec>, use <java> and set fork="true" for safety.




Re: axis ant task in netbeans

Posted by Gene Chuang <ge...@yahoo.com>.
Thanks for all your valuable input Steve.
>Well, ant does its thing differently; you can't really align the codebase that well
Given that axis standalone commandlines (WSDL2Java, Java2WSDL and Admin) are more stable and better supported than their ant-task counterparts, would it be simply better (or possible) for me to write <target>'s that invoke <exec> of the former java programs rather than trying to run the axis ant-tasks?
 Steve Loughran <st...@iseran.com> wrote:
----- Original Message -----
From: "Gene Chuang" 
To: 
Sent: Thursday, January 02, 2003 11:00
Subject: Re: axis ant task in netbeans


>
> >I'd try specifiying an output="some file name" attr
> Yup, that did the trick, at least when running the task in NetBeans. The
wsdl was generated after the "BUILD SUCCESSFUL" message, although
subsequently NB pops an Exception window with a StackOverflow message:
> Annotation: Exception occurred in Request Processor
> java.lang.StackOverflowError
> at java.util.HashMap.hash(HashMap.java:257)
> at java.util.HashMap.get(HashMap.java:313)
> at java.util.Collections$SynchronizedMap.get(Collections.java:1938)
> at
org.apache.tools.ant.module.api.lIntrospectedInfo.isKnown(IntrospectedInfo.j
ava:244)
> at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:386)
> at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:452)
> at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:452)
> ...
> Oh well, I got the wsdl finally from the Ant, so I'm not gonna worry too
much about this. However, with the output="file" attr, running Ant from
commandline still gets me the WSDLException faultCode=PARSER_ERROR. I'm not
sure why the two runs are going through different codepaths, unless this is
still a classpath issue...

Its probably attributable to XML parsers.

> I'm also surprised that the the standalone Java2WSDL and ant-task
Java2Wsdl do not use the same code for >attribute processing; this accounts
for the majority of the stumbling blocks I'm going through, having to plug
in >default values that I assume will be supplied to me.

Well, ant does its thing differently; you cant really align the codebase
that well.

>Hopefully this will change in the next release?

no, though we have patched that extraClasses NPE you discovered.

Re: axis ant task in netbeans

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Gene Chuang" <ge...@yahoo.com>
To: <ax...@xml.apache.org>
Sent: Thursday, January 02, 2003 11:00
Subject: Re: axis ant task in netbeans


>
> >I'd try specifiying an output="some file name" attr
> Yup, that did the trick, at least when running the task in NetBeans.  The
wsdl was generated after the "BUILD SUCCESSFUL" message, although
subsequently NB pops an Exception window with a StackOverflow message:
> Annotation:  Exception occurred in Request Processor
> java.lang.StackOverflowError
>   at java.util.HashMap.hash(HashMap.java:257)
>   at java.util.HashMap.get(HashMap.java:313)
>   at java.util.Collections$SynchronizedMap.get(Collections.java:1938)
>   at
org.apache.tools.ant.module.api.lIntrospectedInfo.isKnown(IntrospectedInfo.j
ava:244)
>   at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:386)
>   at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:452)
>   at
org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.j
ava:452)
>   ...
> Oh well, I got the wsdl finally from the Ant, so I'm not gonna worry too
much about this.  However, with the output="file" attr, running Ant from
commandline still gets me the WSDLException faultCode=PARSER_ERROR.  I'm not
sure why the two runs are going through different codepaths, unless this is
still a classpath issue...

Its probably attributable to XML parsers.

> I'm also surprised that the the standalone Java2WSDL and ant-task
Java2Wsdl do not use the same code for >attribute processing;  this accounts
for the majority of the stumbling blocks I'm going through, having to plug
in >default values that I assume will be supplied to me.

Well, ant does its thing differently; you cant really align the codebase
that well.

>Hopefully this will change in the next release?

no, though we have patched that extraClasses NPE you discovered.


Re: axis ant task in netbeans

Posted by Gene Chuang <ge...@yahoo.com>.
>I'd try specifiying an output="some file name" attr
Yup, that did the trick, at least when running the task in NetBeans.  The wsdl was generated after the "BUILD SUCCESSFUL" message, although subsequently NB pops an Exception window with a StackOverflow message:
Annotation:  Exception occurred in Request Processor
java.lang.StackOverflowError
  at java.util.HashMap.hash(HashMap.java:257)
  at java.util.HashMap.get(HashMap.java:313)
  at java.util.Collections$SynchronizedMap.get(Collections.java:1938)
  at org.apache.tools.ant.module.api.lIntrospectedInfo.isKnown(IntrospectedInfo.java:244)
  at org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.java:386)
  at org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.java:452)
  at org.apache.tools.ant.module.api.lIntrospectedInfo.analyze(IntrospectedInfo.java:452)
  ...
Oh well, I got the wsdl finally from the Ant, so I'm not gonna worry too much about this.  However, with the output="file" attr, running Ant from commandline still gets me the WSDLException faultCode=PARSER_ERROR.  I'm not sure why the two runs are going through different codepaths, unless this is still a classpath issue...  
I'm also surprised that the the standalone Java2WSDL and ant-task Java2Wsdl do not use the same code for attribute processing;  this accounts for the majority of the stumbling blocks I'm going through, having to plug in default values that I assume will be supplied to me.  Hopefully this will change in the next release?
Gene
 Steve Loughran <st...@iseran.com> wrote:
----- Original Message -----
From: "Gene Chuang" 
To: 
Sent: Wednesday, January 01, 2003 18:59
Subject: Re: axis ant task in netbeans


>
> Whoops, sorry about posting Classpath-related exceptions. After going
through the Ant manual, I rewrote my build.xml so now it looks like:
> 

> 

> 

> 

> 

> 

> 

> 

> 
> name="java2wsdl">
> 
> location="${my_url}">
> 
> 
> 
> 


> If I run ant java2wsdl task from NetBeans 3.4, I get:
> Java2WSDL com.overture.service.Advertiser
> java.io.FileNotFoundException: . (Access is denied)
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.(FileOutputStream.java:176)
> at java.io.FileOutputStream.(FileOutputStream.java:131)
> at
org.apache.axis.wsdl.fromJava.Emitter.prettyDocumentToFile(Emitter.java:1330
)


I'd try specifiying an output="some file name" attr, as that the netbeans
failure looks related to that (and where its notion of the current directory
is, I suspect). That might give you a consistent failure across both
invocation mechanisms.

> If I run "ant java2wsdl" from commandline, I get the following error:
> [axis-java2wsdl] [Fatal Error] :2:51: The value of the attribute
"prefix="xmlns" ,localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings
> may not be empty. [axis-java2wsdl] WSDLException: faultCode=PARSER_ERROR:
Problem parsing '- WSDL Document -'.: The value of the attribute
"prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings may not be empty.: org.xml.sax.SAXParseException: The
value of the attribute
"prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings may not be empty.

That I dont know.

Re: axis ant task in netbeans

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Gene Chuang" <ge...@yahoo.com>
To: <ax...@xml.apache.org>
Sent: Wednesday, January 01, 2003 18:59
Subject: Re: axis ant task in netbeans


>
> Whoops, sorry about posting Classpath-related exceptions.  After going
through the Ant manual, I rewrote my build.xml so now it looks like:
> <project>
>   <path id="axisjars"\>
>   <path id="xercesjar"\>
>   <path id="project.classpath">
>       <pathelement location="."/>
>       <path refid="axisjars"/>
>       <path refid="xercesjar"/>
>   </path>
>   <taskdef classpathref="axisjars" resource="axis-tasks.properties"/>
>     <target depends="init" description="Generate WSDL from classes."
name="java2wsdl">
>         <echo message="Building wsdl for ${my_service} at ${my_url}"/>
>         <axis-java2wsdl extraclasses="" classname="${my_service}"
location="${my_url}">
>             <classpath refid="project.classpath"/>
>         </axis-java2wsdl>
>     </target>
> </project>

> If I run ant java2wsdl task from NetBeans 3.4, I get:
> Java2WSDL com.overture.service.Advertiser
> java.io.FileNotFoundException: . (Access is denied)
>         at java.io.FileOutputStream.open(Native Method)
>         at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
>         at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>         at
org.apache.axis.wsdl.fromJava.Emitter.prettyDocumentToFile(Emitter.java:1330
)


I'd try specifiying an output="some file name" attr, as that the netbeans
failure looks related to that (and where its notion of the current directory
is, I suspect). That might give you a consistent failure across both
invocation mechanisms.

> If I run "ant java2wsdl" from commandline, I get the following error:
> [axis-java2wsdl] [Fatal Error] :2:51: The value of the attribute
"prefix="xmlns" ,localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings
> may not be empty. [axis-java2wsdl] WSDLException: faultCode=PARSER_ERROR:
Problem parsing '- WSDL Document -'.: The value of the attribute
"prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings may not be empty.: org.xml.sax.SAXParseException: The
value of the attribute
"prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed
namespace bindings may not be empty.

That I dont know.


Re: axis ant task in netbeans

Posted by Gene Chuang <ge...@yahoo.com>.
Whoops, sorry about posting Classpath-related exceptions.  After going through the Ant manual, I rewrote my build.xml so now it looks like:
<project>
  <path id="axisjars"\>
  <path id="xercesjar"\>
  <path id="project.classpath">
      <pathelement location="."/>
      <path refid="axisjars"/>
      <path refid="xercesjar"/>
  </path>
  <taskdef classpathref="axisjars" resource="axis-tasks.properties"/>
    <target depends="init" description="Generate WSDL from classes." name="java2wsdl">
        <echo message="Building wsdl for ${my_service} at ${my_url}"/>
        <axis-java2wsdl extraclasses="" classname="${my_service}" location="${my_url}">
            <classpath refid="project.classpath"/>
        </axis-java2wsdl>
    </target>
</project>
But now I get 2 totally different kinds of exception, depending on whether I run from commandline or from NetBeans.
If I run "ant java2wsdl" from commandline, I get the following error:
[axis-java2wsdl] Using CLASSPATH C:\java\projects\webservices;C:\java\apache\axis-1_1beta\lib\axis-ant.jar;C:\java\apache\axis-1_1beta\lib\axis.jar;C:\java\apac
he\axis-1_1beta\lib\commons-discovery.jar;C:\java\apache\axis-1_1beta\lib\commons-logging.jar;C:\java\apache\axis-1_1beta\lib\jaxrpc.jar;C:\java\apache\axis-1_1
beta\lib\log4j-1.2.4.jar;C:\java\apache\axis-1_1beta\lib\saaj.jar;C:\java\apache\axis-1_1beta\lib\wsdl4j.jar;C:\java\apache\xerces-1_4_4\xerces.jar
[axis-java2wsdl] [Fatal Error] :2:51: The value of the attribute "prefix="xmlns" ,localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed namespace bindings
may not be empty. [axis-java2wsdl] WSDLException: faultCode=PARSER_ERROR: Problem parsing '- WSDL Document -'.: The value of the attribute "prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed namespace bindings may not be empty.: org.xml.sax.SAXParseException: The value of the attribute "prefix="xmlns",localpart="impl",rawname="xmlns:impl"" is invalid. Prefixed namespace bindings may not be empty.
[axis-java2wsdl]        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
[axis-java2wsdl]        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
[axis-java2wsdl]        at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
[axis-java2wsdl]        at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
[axis-java2wsdl]        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:269)
[axis-java2wsdl]        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:338)
[axis-java2wsdl]        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
[axis-java2wsdl]        at org.apache.tools.ant.Task.perform(Task.java:319)
[axis-java2wsdl]        at org.apache.tools.ant.Target.execute(Target.java:309)
[axis-java2wsdl]        at org.apache.tools.ant.Target.performTasks(Target.java:336)
[axis-java2wsdl]        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[axis-java2wsdl]        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
[axis-java2wsdl]        at org.apache.tools.ant.Main.runBuild(Main.java:610)
[axis-java2wsdl]        at org.apache.tools.ant.Main.start(Main.java:196)
[axis-java2wsdl]        at org.apache.tools.ant.Main.main(Main.java:235)
[axis-java2wsdl]
[axis-java2wsdl]        at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
[axis-java2wsdl]        at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
[axis-java2wsdl]        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:269)
[axis-java2wsdl]        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:338)
[axis-java2wsdl]        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
[axis-java2wsdl]        at org.apache.tools.ant.Task.perform(Task.java:319)
[axis-java2wsdl]        at org.apache.tools.ant.Target.execute(Target.java:309)
[axis-java2wsdl]        at org.apache.tools.ant.Target.performTasks(Target.java:336)
[axis-java2wsdl]        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[axis-java2wsdl]        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
[axis-java2wsdl]        at org.apache.tools.ant.Main.runBuild(Main.java:610)
[axis-java2wsdl]        at org.apache.tools.ant.Main.start(Main.java:196)
[axis-java2wsdl]        at org.apache.tools.ant.Main.main(Main.java:235)
BUILD FAILED
If I run ant java2wsdl task from NetBeans 3.4, I get:
Using CLASSPATH C:\java\projects\webservices;C:\java\apache\axis-1_1beta\lib\axis-ant.jar;C:\java\apache\axis-1_1beta\lib\axis.jar;C:\java\apache\axis-1_1beta\lib\commons-discovery.jar;C:\java\apache\axis-1_1beta\lib\commons-logging.jar;C:\java\apache\axis-1_1beta\lib\jaxrpc.jar;C:\java\apache\axis-1_1beta\lib\log4j-1.2.4.jar;C:\java\apache\axis-1_1beta\lib\saaj.jar;C:\java\apache\axis-1_1beta\lib\wsdl4j.jar;C:\java\apache\xerces-1_4_4\xerces.jar
Running Java2WsdlAntTask with parameters:
        namespace:
        PkgtoNS:{}
        location:http://localhost:8080/axis/services/advertiser
        output:.
        importSchema:null
        input:null
        className:com.overture.service.Advertiser
        servicePortName:null
        portTypeName:null
        bindingName:null
        implClass:null
        inheritance:false
        excluded:null
        stopClasses:null
        typeMappingVersion:1.1
        style:null
        outputImpl:null
        use:null
        namespaceImpl:null
        locationImport:null
        serviceElementName:null
        methods:null
        extraClasses:
Java2WSDL com.overture.service.Advertiser
java.io.FileNotFoundException: . (Access is denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
        at org.apache.axis.wsdl.fromJava.Emitter.prettyDocumentToFile(Emitter.java:1330)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:356)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:294)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
file:C:/java/projects/webservices/build.xml:77: Error while running org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:264)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:294)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
Caused by: java.io.FileNotFoundException: . (Access is denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
        at org.apache.axis.wsdl.fromJava.Emitter.prettyDocumentToFile(Emitter.java:1330)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:356)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
        ... 7 more
--- Nested Exception ---
java.io.FileNotFoundException: . (Access is denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
        at org.apache.axis.wsdl.fromJava.Emitter.prettyDocumentToFile(Emitter.java:1330)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:356)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:294)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
BUILD FAILED

Any ideas?
Gene
 Steve Loughran <st...@iseran.com> wrote:
----- Original Message -----
From: "Gene Chuang" 
To: 
Sent: Sunday, December 29, 2002 21:19
Subject: Re: axis ant task in netbeans


>
>
> Thanks for the pointers guys. I'm ALMOST there! I added the classpathref
to taskdef, but then ANT complained of not finding my service class. So I
added to the task:
> 
> 

> 
> But now I get a NullPointer
> java.lang.NullPointerException
> at java.util.StringTokenizer.(StringTokenizer.java:119)
> at java.util.StringTokenizer.(StringTokenizer.java:135)
> at
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.jav
a:177)

> I examined Java2WsdlAntTask.java (cvs ver 1.14) and noticed the NPE is
occuring because execute() is trying to StrTok the value of 'extraClasses',
an attribute I did not set (do I need to?)

looks like a bug. will fix in CVS.

>So to circumvent the NPE, I added extraClasses="" attribute, but now I get
this:
> Java2WSDL com.overture.service.Advertiser
> java.lang.NoClassDefFoundError: javax/xml/namespace/QName
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Class.java:1627)
> at java.lang.Class.privateGetPublicMethods(Class.java:1655)
> at java.lang.Class.getMethod0(Class.java:1744)

That means that something isnt in the classpath for the task declaration,
specifically whatever contains the missing class... jaxrpc.jar would be a
guess.

Re: axis ant task in netbeans

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Gene Chuang" <ge...@yahoo.com>
To: <ax...@xml.apache.org>
Sent: Sunday, December 29, 2002 21:19
Subject: Re: axis ant task in netbeans


>
>
> Thanks for the pointers guys.  I'm ALMOST there!  I added the classpathref
to taskdef, but then ANT complained of not finding my service class.  So I
added <classpath> to the task:
> <axis-java2wsdl classname="com.my.Service" location="${service_url}">
>   <classpath><pathelement location="."/></classpath>
> </axis-java2wsdl>
> But now I get a NullPointer
> java.lang.NullPointerException
>         at java.util.StringTokenizer.<init>(StringTokenizer.java:119)
>         at java.util.StringTokenizer.<init>(StringTokenizer.java:135)
>         at
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.jav
a:177)

> I examined Java2WsdlAntTask.java (cvs ver 1.14) and noticed the NPE is
occuring because execute() is trying to StrTok the value of 'extraClasses',
an attribute I did not set (do I need to?)

looks like a bug. will fix in CVS.

>So to circumvent the NPE, I added extraClasses="" attribute, but now I get
this:
> Java2WSDL com.overture.service.Advertiser
> java.lang.NoClassDefFoundError: javax/xml/namespace/QName
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Class.java:1627)
>         at java.lang.Class.privateGetPublicMethods(Class.java:1655)
>         at java.lang.Class.getMethod0(Class.java:1744)

That means that something isnt in the classpath for the task declaration,
specifically whatever contains the missing class... jaxrpc.jar would be a
guess.


Re: axis ant task in netbeans

Posted by Gene Chuang <ge...@yahoo.com>.

Thanks for the pointers guys.  I'm ALMOST there!  I added the classpathref to taskdef, but then ANT complained of not finding my service class.  So I added <classpath> to the task:
<axis-java2wsdl classname="com.my.Service" location="${service_url}">
  <classpath><pathelement location="."/></classpath>
</axis-java2wsdl>
But now I get a NullPointer
java.lang.NullPointerException
        at java.util.StringTokenizer.<init>(StringTokenizer.java:119)
        at java.util.StringTokenizer.<init>(StringTokenizer.java:135)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:177)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:294)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
BUILD FAILED
I examined Java2WsdlAntTask.java (cvs ver 1.14) and noticed the NPE is occuring because execute() is trying to StrTok the value of 'extraClasses', an attribute I did not set (do I need to?)  So to circumvent the NPE, I added extraClasses="" attribute, but now I get this:
Java2WSDL com.overture.service.Advertiser
java.lang.NoClassDefFoundError: javax/xml/namespace/QName
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:1627)
        at java.lang.Class.privateGetPublicMethods(Class.java:1655)
        at java.lang.Class.getMethod0(Class.java:1744)
        at java.lang.Class.getMethod(Class.java:963)
        at org.apache.axis.wsdl.fromJava.Types.isEnumClass(Types.java:728)
        at org.apache.axis.wsdl.fromJava.Types.makeTypeElement(Types.java:1255)
        at org.apache.axis.wsdl.fromJava.Types.writeTypeForPart(Types.java:326)
        at org.apache.axis.wsdl.fromJava.Emitter.writePartToMessage(Emitter.java:1272)
        at org.apache.axis.wsdl.fromJava.Emitter.writeResponseMessage(Emitter.java:1132)
        at org.apache.axis.wsdl.fromJava.Emitter.writeMessages(Emitter.java:884)
        at org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:841)
        at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:387)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:268)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:338)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:249)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:294)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
Running Ant is becoming more troublesome than it's worth;  what other hoops do I have to jump through to get axis-java2wsdl task to work?  Like I previously stated, I can generate the wsdl via commandline:
java org.apache.axis.wsdl.Java2WSDL com.my.Service test.wsdl
Am I missing any required attributes in Ant that are not required in the commandline?
Gene
btw, I'm running NetBeans 3.4, Ant 1.5.1 and Axisi 1.1beta on Windows XP.
 
 Steve Loughran <st...@iseran.com> wrote:
----- Original Message -----
From: "Chris Schaefer" 
To: 
Sent: Sunday, December 29, 2002 17:17
Subject: Re: axis ant task in netbeans


> Gene:
> you are very close.... it all has to do with classpaths and the
> stuff. Here's
> what I did in my build.xml. I had axis installed at /usr/local/axis
>
> 

> 
> 
> 
> 

> 
>
> This is including every jar in the axis subdirectory which is overkill,
but
> not bad that I know of except for efficiency reasons. I suspect you could
> provide a more explicit include and make stuff run a bit faster.

I am not sure it is that much overkill; the task depends on axis.jar,
commons-logging.jar, mybe wsdl4j.jar and indirectly on log4j though that is
not mandatory. the **/*.jar inclusion is the safest way to get all you need.

Also, if Netbeans is running Ant1.4.1 then I dont guarantee the tasks work.
They were built against ant1.5 and so may not be backwards compatible,
though I dont think there are any deliberate attempts to be incompatible.

-Steve

Re: axis ant task in netbeans

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Chris Schaefer" <ax...@1reality.org>
To: <ax...@xml.apache.org>
Sent: Sunday, December 29, 2002 17:17
Subject: Re: axis ant task in netbeans


> Gene:
>     you are very close.... it all has to do with classpaths and the
> stuff.  Here's
> what I did  in my build.xml.   I had axis installed at /usr/local/axis
>
> <path id="axis.classpath">
>                    <fileset dir="/usr/local/axis/lib/">
>                      <include name="**/*.jar" />
>                    </fileset>
> </path>
> <taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />
>
> This is including every jar in the axis subdirectory which is overkill,
but
> not bad that I know of except for efficiency reasons.  I suspect you could
> provide a more explicit include and make stuff run a bit faster.

I am not sure it is that much overkill; the task depends on axis.jar,
commons-logging.jar, mybe wsdl4j.jar and indirectly on log4j though that is
not mandatory. the **/*.jar inclusion is the safest way to get all you need.

Also, if Netbeans is running Ant1.4.1 then I dont guarantee the tasks work.
They were built against ant1.5 and so may not be backwards compatible,
though I dont think there are any deliberate attempts to be incompatible.

-Steve


Re: axis ant task in netbeans

Posted by Chris Schaefer <ax...@1reality.org>.
Gene:
    you are very close.... it all has to do with classpaths and the 
stuff.  Here's
what I did  in my build.xml.   I had axis installed at /usr/local/axis

<path id="axis.classpath">
                   <fileset dir="/usr/local/axis/lib/">
                     <include name="**/*.jar" />
                   </fileset>
</path>
<taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />

This is including every jar in the axis subdirectory which is overkill, but
not bad that I know of except for efficiency reasons.  I suspect you could
provide a more explicit include and make stuff run a bit faster.

Hope that helps.

-C-

>I'm relatively new to Web services, ANT and NetBeans (although an 
>old hat to J2EE, make and vi), so I figure I learn all 3 
>simultaneously for my prototype project.
>
>I can run java2wsdI manually from the commandline, but I cannot get 
>the java2wsdl ant task to run properly under netbeans.  This is what 
>I've done:
>
>1)  put axis-ant.jar in NETBEANS_HOME/lib
>2)  added the following entry to build.xml:
>  <target description="java2wsdl">
>    <axis-java2wsdl classname="${my_service}" location="${my_url}"/>
>  </target>
>
>When I build this target, I get "Could not create task or type of 
>type: axis-java2wsdl".  So next I tried adding the following
>
>3) added at beginning of build.xml:
>  <taskdef name="axis-java2wsdl" 
>classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"/>
>
>Now I get "taskdef class 
>org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask cannot be found". 
>Help!  Am I placing axis-ant.jar in the wrong place?  Or is my 
>build.xml syntax horribly wrong?  Thanks!
>
>Gene
>
>