You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Shields, John (HQP)" <Jo...@rhi.com> on 2004/02/28 01:53:02 UTC

RE: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTa sks

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
Settings\johshi01\.maven\repository\xerces\jars\xercesImpl-2.4.0.jar;C:\Docu
ments and Settings\johshi01\.maven\repository\xalan\jars\xalan-2.5.1.jar'
-keep -tmpdir C:\cvsroot\pmi\server\target\wsdeploy-generated -o
C:\cvsroot\pmi\server\target\pmi-server.war -verbose
C:\cvsroot\pmi\server\target\pmi-server-portable.war"/>
    </ant:exec>
    -->
  </postGoal>

</project>



-----Original Message-----
From: Shields, John (HQP) [mailto:John.Shields@rhi.com] 
Sent: Friday, February 27, 2004 4:51 PM
To: 'users@maven.apache.org'
Subject: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTasks

Hello,

I keep receiving the following error when trying to run the JAX-RPC ant
tasks from within Maven. I just cannot seem to find the problem. I have a
suspicion that I'm in ClassLoader hell, but I'm not sure. I'm using JDK
1.4.2_03, Maven-1.0-rc1, and JWSDP-1.3.

The strangest thing is that if I change my maven.xml file to execute the
JWSDP-1.3 command line tools directly then everything works. However, I
would like to not have a dependency on the JWSDP tools if at all possible
(jar files are OK, of course). Another project at my company is using the
ant tasks successfully from ant, but they haven't tried it from Maven.

Here is the pertinent part of the output from Maven with the "--debug
--exception" flags set:

    [wsdeploy] [DEBUG] Finding class com.sun.xml.rpc.util.JavaCompilerHelper
    [wsdeploy] [DEBUG] Class com.sun.xml.rpc.util.JavaCompilerHelper loaded
from ant loader
    [wsdeploy] [DEBUG] Class java.lang.NoSuchMethodException loaded from
parent loader
    [wsdeploy] [DEBUG] Class java.lang.reflect.InvocationTargetException
loaded from parent loader
    [wsdeploy] [DEBUG] Class java.io.PrintWriter loaded from parent loader
    [wsdeploy] [DEBUG] Class java.lang.Thread loaded from parent loader
    [wsdeploy] error: java.lang.NullPointerException
    [wsdeploy] java.lang.NullPointerException
    [wsdeploy] 	at
com.sun.xml.rpc.util.JavaCompilerHelper.internalCompile(JavaCompilerHelper.j
ava:45)
    [wsdeploy] 	at
com.sun.xml.rpc.util.JavaCompilerHelper.compile(JavaCompilerHelper.java:32)
    [wsdeploy] 	at
com.sun.xml.rpc.tools.wscompile.CompileTool.compileGeneratedClasses(CompileT
ool.java:876)
    [wsdeploy] 	at
com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:578)
    [wsdeploy] 	at
com.sun.xml.rpc.tools.wsdeploy.DeployTool.process(DeployTool.java:303)
    [wsdeploy] 	at
com.sun.xml.rpc.tools.wsdeploy.DeployTool.run(DeployTool.java:213)
    [wsdeploy] 	at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:40)
    [wsdeploy] 	at
com.sun.xml.rpc.tools.ant.Wsdeploy.execute(Wsdeploy.java:351)
    [wsdeploy] 	at org.apache.tools.ant.Task.perform(Task.java:341)
    [wsdeploy] 	at
org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)

>From the source code provided for the JWSDP on http://www.java.net/ I
believe that the offending code is somewhere in here (I don't think the line
numbers match up exactly between the released source and the 1.3 binaries):


		ClassLoader cl =
Thread.currentThread().getContextClassLoader();
		Class comSunToolsJavacMainClass = null;
		try {
			/* try to use the new compiler */
			comSunToolsJavacMainClass =
				cl.loadClass("com.sun.tools.javac.Main");
			try {
				Method compileMethod =
					comSunToolsJavacMainClass.getMethod(
						"compile",
						compile141MethodSignature);
				try {
					Object result =
						compileMethod.invoke(
							null,
							new Object[] { args,
new PrintWriter(out)});
					if (!(result instanceof Integer)) {
						return false;
					}
					return ((Integer) result).intValue()
== 0;
				} catch (IllegalAccessException e3) {
					return false;
				} catch (IllegalArgumentException e3) {
					return false;
				} catch (InvocationTargetException e3) {
					return false;
				}
			} catch (NoSuchMethodException e2) {
				//tryout 1.3.1 signature
				return internalCompilePre141(args);
	
//onError(getMessage("javacompiler.nosuchmethod.error",
"getMethod(\"compile\", compile141MethodSignature)"));
				//return false;
			}
		} catch (ClassNotFoundException e) {
			onError(
				getMessage(
					"javacompiler.classpath.error",
					"com.sun.tools.javac.Main"));
			return false;
		} catch (SecurityException e) {
			return false;
		}

"tools.jar" is explicitly added to the classpath using "${tools.jar}" so
"com.sun.tools.javac.Main" should be there.

Attached are maven.xml and a strange *.h file that appeared in my working
directory.

I've been grappling with this all day (!!) and would greatly appreciate some
help. I feel like it's something simple that I'm missing, but who knows...

Thanks!

John





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTa sks

Posted by Webb Morris <we...@yahoo.com>.
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)" <Jo...@rhi.com> 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
> Settings\johshi01\.maven\repository\xerces\jars\xercesImpl-2.4.0.jar;C:\Docu
> ments and Settings\johshi01\.maven\repository\xalan\jars\xalan-2.5.1.jar'
> -keep -tmpdir C:\cvsroot\pmi\server\target\wsdeploy-generated -o
> C:\cvsroot\pmi\server\target\pmi-server.war -verbose
> C:\cvsroot\pmi\server\target\pmi-server-portable.war"/>
>     </ant:exec>
>     -->
>   </postGoal>
> 
> </project>
> 
> 
> 
> -----Original Message-----
> From: Shields, John (HQP) [mailto:John.Shields@rhi.com] 
> Sent: Friday, February 27, 2004 4:51 PM
> To: 'users@maven.apache.org'
> Subject: NullPointerException Running JAX-RPC wscompile/wsdeploy AntTasks
> 
> Hello,
> 
> I keep receiving the following error when trying to run the JAX-RPC ant
> tasks from within Maven. I just cannot seem to find the problem. I have a
> suspicion that I'm in ClassLoader hell, but I'm not sure. I'm using JDK
> 1.4.2_03, Maven-1.0-rc1, and JWSDP-1.3.
> 
> The strangest thing is that if I change my maven.xml file to execute the
> JWSDP-1.3 command line tools directly then everything works. However, I
> would like to not have a dependency on the JWSDP tools if at all possible
> (jar files are OK, of course). Another project at my company is using the
> ant tasks successfully from ant, but they haven't tried it from Maven.
> 
> Here is the pertinent part of the output from Maven with the "--debug
> --exception" flags set:
> 
>     [wsdeploy] [DEBUG] Finding class com.sun.xml.rpc.util.JavaCompilerHelper
>     [wsdeploy] [DEBUG] Class com.sun.xml.rpc.util.JavaCompilerHelper loaded
> from ant loader
>     [wsdeploy] [DEBUG] Class java.lang.NoSuchMethodException loaded from
> parent loader
>     [wsdeploy] [DEBUG] Class java.lang.reflect.InvocationTargetException
> loaded from parent loader
>     [wsdeploy] [DEBUG] Class java.io.PrintWriter loaded from parent loader
>     [wsdeploy] [DEBUG] Class java.lang.Thread loaded from parent loader
>     [wsdeploy] error: java.lang.NullPointerException
>     [wsdeploy] java.lang.NullPointerException
>     [wsdeploy] 	at
> com.sun.xml.rpc.util.JavaCompilerHelper.internalCompile(JavaCompilerHelper.j
> ava:45)
>     [wsdeploy] 	at
> com.sun.xml.rpc.util.JavaCompilerHelper.compile(JavaCompilerHelper.java:32)
>     [wsdeploy] 	at
> com.sun.xml.rpc.tools.wscompile.CompileTool.compileGeneratedClasses(CompileT
> ool.java:876)
>     [wsdeploy] 	at
> com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:578)
>     [wsdeploy] 	at
> com.sun.xml.rpc.tools.wsdeploy.DeployTool.process(DeployTool.java:303)
>     [wsdeploy] 	at
> com.sun.xml.rpc.tools.wsdeploy.DeployTool.run(DeployTool.java:213)
>     [wsdeploy] 	at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:40)
>     [wsdeploy] 	at
> com.sun.xml.rpc.tools.ant.Wsdeploy.execute(Wsdeploy.java:351)
>     [wsdeploy] 	at org.apache.tools.ant.Task.perform(Task.java:341)
>     [wsdeploy] 	at
> org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
> 
> From the source code provided for the JWSDP on http://www.java.net/ I
> 
=== message truncated ===


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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org