You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Matthew Pocock <ma...@yahoo.co.uk> on 2003/10/23 19:14:25 UTC

ClassLoader in Emitter

Hi,

I've hit a snag with the axis-java2wsdl task. It doesn't accept a 
classpath from which classes can be loaded. This means that we can only 
work with classes that are in the ant classpath. Is this just one of 
those things, or was it a concious design decision?

Can I propose that we add a ClassLoader property in 
org/apache/axis/wsdl/fromJava/Emitter.java from which it loads all 
classes by name? This can be complemented by adding a -classpath option 
to java2wsdl (both ant task and application). People who know the 
code-base better may have a more approreate place for the suplementary 
ClassLoader property.

I'm hacking my copy of the code from anonymous CVS and will be happy to 
feed code back into the project.

Best,

Matthew

[axis-java2wsdl] log4j:WARN No appenders could be found for logger 
(org.apache.axis.i18n.ProjectResourceBundle).
[axis-java2wsdl] log4j:WARN Please initialize the log4j system properly.
[axis-java2wsdl] Java2WSDL 
uk.org.microbase.bioserialize.FeatureEchoerService
[axis-java2wsdl] java.lang.ClassNotFoundException: 
uk.org.microbase.bioserialize.FeatureEchoerService
[axis-java2wsdl]        at 
org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1073)
[axis-java2wsdl]        at 
org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1034)
[axis-java2wsdl]        at 
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:923)
[axis-java2wsdl]        at 
java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[axis-java2wsdl]        at 
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[axis-java2wsdl]        at java.lang.Class.forName0(Native Method)
[axis-java2wsdl]        at java.lang.Class.forName(Class.java:141)
[axis-java2wsdl]        at 
org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:199)
[axis-java2wsdl]        at 
java.security.AccessController.doPrivileged(Native Method)
[axis-java2wsdl]        at 
org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:173)
[axis-java2wsdl]        at 
org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:114)
[axis-java2wsdl]        at 
org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:1553)
[axis-java2wsdl]        at 
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:206)
[axis-java2wsdl]        at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:166)
[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
file:/home/mrp/devel/microbase/build.xml:359: Error while running 
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask



Re: ClassLoader in Emitter

Posted by Matthew Pocock <ma...@yahoo.co.uk>.
Ok - written some code.

Steve Loughran wrote:

> Matthew Pocock wrote:

>>
>> Is this just one of those things, or was it a concious design decision?
>
>
> an accident; there is an open bug on it. 

:)

>> I'm hacking my copy of the code from anonymous CVS and will be happy 
>> to feed code back into the project.
>
> The other place to put it in would be the ant task itself. Ant1.6 has 
> a classloader mechanism you could reuse (antclassloader). If you 
> implement your own you need to test your changes under both Ant1.6 and 
> ant-under-IDE to make sure that all is still well.
>
Yes. After reading all the sources more carefully, I found that one of 
the ant tasks had been modified (but not documented) so that it takes a 
<classpath> child element of the axis type Path. So, I've ported this 
functionality over to the other ant task, and also modified ClassUtils 
so that it has a more sane default class loader. Also, I've modified the 
WSDL2Java to accept a classpath option. I didn't have time to do 
Java2WSDL. The ant tasks appear to work - I've built something with 
them. I haven't tried WSDL2Java.

Best,

Matthew


Re: ClassLoader in Emitter

Posted by Steve Loughran <st...@iseran.com>.
Matthew Pocock wrote:
> Hi,
> 
> I've hit a snag with the axis-java2wsdl task. It doesn't accept a 
> classpath from which classes can be loaded. This means that we can only 
> work with classes that are in the ant classpath. Is this just one of 
> those things, or was it a concious design decision?

an accident; there is an open bug on it.


> Can I propose that we add a ClassLoader property in 
> org/apache/axis/wsdl/fromJava/Emitter.java from which it loads all 
> classes by name? This can be complemented by adding a -classpath option 
> to java2wsdl (both ant task and application). People who know the 
> code-base better may have a more approreate place for the suplementary 
> ClassLoader property.
> 
> I'm hacking my copy of the code from anonymous CVS and will be happy to 
> feed code back into the project.


The other place to put it in would be the ant task itself. Ant1.6 has a 
classloader mechanism you could reuse (antclassloader). If you implement 
your own you need to test your changes under both Ant1.6 and 
ant-under-IDE to make sure that all is still well.



Re: ClassLoader in Emitter

Posted by Davanum Srinivas <di...@yahoo.com>.
See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21950 for existing bug. Patch would be
AWESOME!!! (http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches)

-- dims


--- Matthew Pocock <ma...@yahoo.co.uk> wrote:
> Hi,
> 
> I've hit a snag with the axis-java2wsdl task. It doesn't accept a 
> classpath from which classes can be loaded. This means that we can only 
> work with classes that are in the ant classpath. Is this just one of 
> those things, or was it a concious design decision?
> 
> Can I propose that we add a ClassLoader property in 
> org/apache/axis/wsdl/fromJava/Emitter.java from which it loads all 
> classes by name? This can be complemented by adding a -classpath option 
> to java2wsdl (both ant task and application). People who know the 
> code-base better may have a more approreate place for the suplementary 
> ClassLoader property.
> 
> I'm hacking my copy of the code from anonymous CVS and will be happy to 
> feed code back into the project.
> 
> Best,
> 
> Matthew
> 
> [axis-java2wsdl] log4j:WARN No appenders could be found for logger 
> (org.apache.axis.i18n.ProjectResourceBundle).
> [axis-java2wsdl] log4j:WARN Please initialize the log4j system properly.
> [axis-java2wsdl] Java2WSDL 
> uk.org.microbase.bioserialize.FeatureEchoerService
> [axis-java2wsdl] java.lang.ClassNotFoundException: 
> uk.org.microbase.bioserialize.FeatureEchoerService
> [axis-java2wsdl]        at 
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1073)
> [axis-java2wsdl]        at 
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1034)
> [axis-java2wsdl]        at 
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:923)
> [axis-java2wsdl]        at 
> java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> [axis-java2wsdl]        at 
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> [axis-java2wsdl]        at java.lang.Class.forName0(Native Method)
> [axis-java2wsdl]        at java.lang.Class.forName(Class.java:141)
> [axis-java2wsdl]        at 
> org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:199)
> [axis-java2wsdl]        at 
> java.security.AccessController.doPrivileged(Native Method)
> [axis-java2wsdl]        at 
> org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:173)
> [axis-java2wsdl]        at 
> org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:114)
> [axis-java2wsdl]        at 
> org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:1553)
> [axis-java2wsdl]        at 
> org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:206)
> [axis-java2wsdl]        at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:166)
> [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
> file:/home/mrp/devel/microbase/build.xml:359: Error while running 
> org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/