I have already added tools.jar to my Maven repository and made a dependency
on it to no avail. But I do think that that may need to stay there, though.

I think the main problem is the JWSDP relies on calling
Thread.currentThread().getContextClassLoader() to get a reference to an
appropriate ClassLoader. It seems that the thread context ClassLoader is
often null for the ant tasks. I don't understand why that happens???

I see that line 439 of "PluginManager.java" (in the Maven sources I have)
sets the thread context classloader to null. Why is that done?

I think that's the problem, but I'd like to understand why that is done.

Cheers,

John


-----Original Message-----
From: Webb Morris [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 01, 2004 5:01 PM
To: Maven Users List
Subject: RE: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTa s
ks

John,

I believe I follow, but hopefully someone else is paying attention to our
thread and will be able
to offer better answers than the ones I'm about to give you:

0. I don't think so, see 1.

1. I don't know. I don't know. ;)

2. I'm away from my projects, but I'll be able to check for sure tomorrow. I
know that I've come
across a problem where tools.jar was not included in the class loader that I
needed for it to be
in, but I can't remember the exact situation. I do remember that in order to
work around this
problem, I faked tools.jar in the repository (under something like
java/jars/tools-1.4.jar) and
added it as a dependency. Gross, I know, but it worked. I've been meaning to
revisit this, just
haven't gotten around to it, yet.

I'll actually be working on a JAX-RPC project tomorrow, so I'll let you know
what kind of
wackiness I encounter.

Hope this helps,

WM


--- "Shields, John (HQP)" <[EMAIL PROTECTED]> wrote:
> Webb,
> 
> Thanks for the tip. Your suggestion prompted me to write a quick test case
> to print out the ClassLoader hierarchy for the pertinent classes. The
output
> is created by calling ClassLoader.getParent() in a loop. Here is the
output:
> 
> Thread Classloader1: [EMAIL PROTECTED]
> Thread Classloader2: [EMAIL PROTECTED]
> Thread Classloader3: [EMAIL PROTECTED]
> Boot Classloader1: [EMAIL PROTECTED]
> Javac Classloader1: [ForeheadClassLoader: name="root"]
> Javac Classloader2: [ForeheadClassLoader: name="$forehead-root$"]
> Javac Classloader3: [EMAIL PROTECTED]
> Javac Classloader4: [EMAIL PROTECTED]
> Compiler Helper Classloader1: [EMAIL PROTECTED]
> Compiler Helper Classloader2: [EMAIL PROTECTED]
> Compiler Helper Classloader3: [EMAIL PROTECTED]
> 
> In the JWSDP, there is a class called JavaCompilerHelper that uses the
> thread context ClassLoader to load "com.sun.tools.javac.Main". As you can
> see from the output above, "...javac.Main" is in a sibling ClassLoader of
> the AntClassLoader which is the thread context ClassLoader. Thus, I think
> the JWSDP ant tasks just can't see tools.jar because they are in a sibling
> ClassLoader, not a child one. So...
> 
> 0. Am I missing something???
> 
> 1. Why is the AntClassLoader a sibling of the ForeheadClassLoader and not
a
> child? Is there a way to change that?
> 
> 2. How do I get tools.jar into the AntClassLoader?
> 
> Thanks!
> 
> John
> 
> -----Original Message-----
> From: Webb Morris [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 01, 2004 1:31 PM
> To: Maven Users List
> Subject: RE: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTa
s
> ks
> 
> Have you tried stating the JWSDP jars as dependencies in your project.xml
> and specifing the
> classloader as root?  I had to do this with some weblogic tasks
(servicegen,
> in particular) in
> order to get ant to recognize them at runtime.
> 
> WM
> 
> 
> --- "Shields, John (HQP)" <[EMAIL PROTECTED]> wrote:
> > Apparently the attachments didn't work. Here is the strange *.h file:
> > 
> > /* DO NOT EDIT THIS FILE - it is machine generated */
> > #include <jni.h>
> > /* Header for class com_sun_tools_javac_Main */
> > 
> > #ifndef _Included_com_sun_tools_javac_Main
> > #define _Included_com_sun_tools_javac_Main
> > #ifdef __cplusplus
> > extern "C" {
> > #endif
> > /* Inaccessible static:
> > class_00024com_00024sun_00024tools_00024javac_00024Main */
> > #ifdef __cplusplus
> > }
> > #endif
> > #endif
> > 
> > And maven.xml:
> > 
> > 
> > <project xmlns:j="jelly:core" xmlns:maven="jelly:maven"
> > xmlns:deploy="deploy" xmlns:ant="jelly:ant">
> > 
> >   <!--
> >     This goal creates the JAX-RPC model and WSDL files and places them
in
> > the expanded
> >     build webapp directory. It runs after the war:webapp goal from the
> Maven
> > war plugin.
> >   -->
> >   <postGoal name="war:webapp">
> >   
> >     <!-- define JAX-RPC ant task -->
> >     <ant:taskdef name="wscompile"
> > classname="com.sun.xml.rpc.tools.ant.Wscompile">
> >       <ant:classpath>
> >         <ant:path refid="maven.dependency.classpath"/>
> >       </ant:classpath>
> >     </ant:taskdef>
> >     
> >     <!-- loop through the resources in project.xml -->
> >     <ant:echo message="resources=${pom.build.resources}"/>
> >     <j:forEach var="resource" items="${pom.build.resources}">
> >       <j:set var="directory" value="${resource.directory}"/>
> >       <ant:echo message="directory=${directory}"/>
> >       
> >       <!-- put XML files from the resource in the 'files' variable -->
> >       <ant:fileScanner var="files">
> >         <ant:fileset dir="${directory}">
> >           <ant:patternset>
> >             <ant:include name="*.xml"/>
> >           </ant:patternset>
> >         </ant:fileset>
> >       </ant:fileScanner>
> >       
> >       <!-- loop the files from the resource -->
> >       <j:forEach var="file" items="${files.iterator()}">
> >         <ant:echo message="file=${file}"/>
> >         
> >         <!-- parse out the model name from the config file name -->
> >         <j:set var="model"
> > value="${file.name.substring(0,file.name.indexOf('.xml'))}-model.gz"/>
> >         <ant:echo message="model=${model}"/>
> >         <ant:mkdir dir="${maven.build.dir}/gen-model"/>
> >         
> >         <!-- generate the model and wsdl files for this config file -->
> >         <ant:wscompile base="${maven.war.webapp.dir}/WEB-INF"
> define="true"
> > verbose="true" classpath="${maven.build.dest}"
> > model="${maven.war.webapp.dir}/WEB-INF/${model}" config="${file}">
> >           <ant:classpath>
> >             <ant:pathelement path="${tools.jar}"/>
> >             <ant:path refid="maven.dependency.classpath"/>
> >           </ant:classpath>
> >         </ant:wscompile>
> >       </j:forEach>
> > 
> >     </j:forEach>
> > 
> >   </postGoal>
> > 
> >   <!--
> >     This goal creates the JAX-RPC implementation files.
> >     It runs after the war:war goal from the Maven war plugin.
> >   -->
> >   <postGoal name="war:war">
> >     <!-- define JAX-RPC ant task -->
> >     <ant:taskdef name="wsdeploy"
> > classname="com.sun.xml.rpc.tools.ant.Wsdeploy">
> >       <ant:classpath>
> >         <ant:pathelement path="${tools.jar}"/>
> >         <ant:path refid="maven.dependency.classpath"/>
> >       </ant:classpath>
> >     </ant:taskdef>
> > 
> >     <ant:mkdir dir="${maven.war.build.dir}/wsdeploy-generated"/>
> >     <ant:move file="${maven.war.build.dir}/${pom.artifactId}.war"
> > tofile="${maven.war.build.dir}/${pom.artifactId}-portable.war"/>
> > 
> >     <ant:wsdeploy
> > inWarFile="${maven.war.build.dir}/${pom.artifactId}-portable.war"
> > outWarFile="${maven.war.build.dir}/${pom.artifactId}.war"
> > tmpDir="${maven.war.build.dir}/wsdeploy-generated" keep="true"
> > verbose="true">
> >       <ant:classpath>
> >         <ant:pathelement path="${tools.jar}"/>
> >         <ant:path refid="maven.dependency.classpath"/>
> >       </ant:classpath>
> >     </ant:wsdeploy>
> >     <!-- this works!!! but it depends on installing the pack. grrr...
> >     <ant:exec executable="c:/jwsdp-1.3/jaxrpc/bin/wsdeploy.bat">
> >       <arg line="-classpath 'C:\j2sdk1.4.2_03\lib\tools.jar;C:\Documents
> and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\jaxrpc-api-1.1.jar;C:\Docume
> > nts and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\jaxrpc-impl-1.1.jar;C:\Docum
> > ents and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\jaxrpc-spi-1.1.jar;C:\Docume
> > nts and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\jax-qname-1.1.jar;C:\Documen
> > ts and
> >
>
Settings\johshi01\.maven\repository\saaj\jars\saaj-api-1.2.jar;C:\Documents
> > and
> >
>
Settings\johshi01\.maven\repository\saaj\jars\saaj-impl-1.2.jar;C:\Documents
> > and
> >
>
Settings\johshi01\.maven\repository\jaf\jars\activation-1.0.2.jar;C:\Documen
> > ts and
> >
>
Settings\johshi01\.maven\repository\javamail\jars\mail-1.2.jar;C:\Documents
> > and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\relaxngDatatype-1.1.jar;C:\D
> > ocuments and
> >
>
Settings\johshi01\.maven\repository\jaxrpc\jars\xsdlib-1.1.jar;C:\Documents
> > and
> >
>
Settings\johshi01\.maven\repository\xerces\jars\xmlParserAPIs-2.2.1.jar;C:\D
> > ocuments and
> >
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to