users@jax-rpc.java.net

Re: Wsdeploy NullPointerException when compiling generated classes using Maven

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Fri, 26 Mar 2004 10:50:07 -0800

Ewan,
I don't have a clue what might be wrong. Definately a classpath issue
though as com.sun.javac.Main is in the tools.jar file of the Sun jdk.

Ewan Harrow wrote:

>Thx Doug. I don't know if you are familiar with maven but I have
>included the bit from maven.xml that calls wsdeploy ant task. To get
>around the same problem from wscompile I just set fork=true. The same
>trick does not work with wsdeploy. The output also includes my hack to
>set the classloader to the system classloader if it was null in
>JavaCompilerHelper.internalCompile() (see previous post).
>
>
>==== maven.xml ====
> <goal name="build-war">
> <echo message="tools.jar=${tools.jar}"/>
> <ant:taskdef name="wsdeploy"
>classname="com.sun.xml.rpc.tools.ant.Wsdeploy">
> <ant:classpath>
> <ant:path refid="maven.dependency.classpath"/>
> <ant:pathelement path="${tools.jar}"/>
> </ant:classpath>
> </ant:taskdef>
>
> <echo message="-------- Creating deployable war ${appname}
>--------"/>
> <mkdir dir="${maven.war.src}/WEB-INF"/>
> <copy file="${maven.src.dir}/conf/jaxrpc-ri.xml"
>todir="${maven.war.src}/WEB-INF"/>
> <copy file="${model.rpcenc.file}"
>todir="${maven.war.src}/WEB-INF"/>
>
> <mkdir dir="${maven.build.dir}/ws/tmp"/>
> <wsdeploy keep="true" tmpDir="${maven.build.dir}/ws/tmp"
>inWarFile="${maven.build.dir}/ws/jaxrpc-${appname}-raw.war"
>outWarFile="${maven.build.dir}/ws/jaxrpc-${appname}.war" verbose="true"
>fork="true">
> <ant:classpath>
> <ant:pathelement path="${tools.jar}"/>
> <ant:path refid="maven.dependency.classpath"/>
> <ant:pathelement
>path="${maven.build.dir}/ws/server/classes"/>
> </ant:classpath>
> </wsdeploy>
> </goal>
>
>====== output =======
> __ __
>| \/ |__ _Apache__ ___
>| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
>|_| |_\__,_|\_/\___|_||_| v. 1.0-rc2
>
>build:start:
>
>build-war:
> [echo] tools.jar=c:\j2sdk1.4.2_02/lib/tools.jar
> [echo] -------- Creating deployable war PromotionEngine --------
> [wsdeploy] command line: wsdeploy -classpath
>"C:\j2sdk1.4.2_02\lib\tools.jar;C:\Documents and
>Settings\ewan.harrow\.maven\repository\junit\jars\junit-3.8.1.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\log4j\jars\log4j-1.2.8.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\mcrl\jars\mcrl-utils-20040322.132027.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\springframework\jars\spring-1.0.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\asm\jars\asm-1.4.1.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\aop-alliance\jars\aopalliance-alpha-1.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\commons-collections\jars\commons-collections-3.0.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\commons-lang\jars\commons-lang-2.0.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\commons-logging\jars\commons-logging-1.0.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\commons-dbcp\jars\commons-dbcp-1.1.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\commons-pool\jars\commons-pool-1.1.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\jax-qname-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\jaxp-api-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\jaxrpc-api-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\jaxrpc-impl-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\jaxrpc-spi-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\relaxngDatatype-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\saaj-api-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\saaj-impl-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\xsdlib-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\activation-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\mail-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\dom-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\jwsdp\jars\xercesImpl-1.3.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\oracle\jars\ojdbc14-1.0.jar;C:\Documents
>and
>Settings\ewan.harrow\.maven\repository\quartz\jars\quartz-1.2.3.jar;D:\devel\java\promoengine\target\ws\server\classes"
>-keep -tmpdir D:\devel\java\promoengine\target\ws\tmp -o
>D:\devel\java\promoengine\target\ws\jaxrpc-PromotionEngine.war -verbose
>D:\devel\java\promoengine\target\ws\jaxrpc-PromotionEngine-raw.war
> [wsdeploy] info: created temporary directory:
>D:\devel\java\promoengine\target\ws\tmp\jaxrpc-deploy-6844c7
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_calcPromotions_RequestStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.PromotionsRequest
>exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.Product exists. Not
>overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_calcPromotions_ResponseStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.PromotionsResponse
>exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.PromotedProduct
>exists. Not overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_getPromotionProducts_RequestStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_getPromotionProducts_ResponseStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionProductsInStore exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.ProductInPromotion
>exists. Not overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_getPromotions_RequestStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class
>com.mcrl.promo.remote.PromotionsCalculator_getPromotions_ResponseStruct
>exists. Not overriding.]
>[CustomClassGenerator: Class com.mcrl.promo.remote.Promotion exists.
>Not overriding.]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}calcPromotions]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}PromotionsRequest]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}Product]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}calcPromotionsResponse]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}PromotionsResponse]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}PromotedProduct]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}getPromotionProducts]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}getPromotionProductsResponse]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}PromotionProductsInStore]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}ProductInPromotion]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}getPromotions]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/wsdl}getPromotionsResponse]
>[SOAPObjectSerializerGenerator: writing serializer/deserializer for:
>{http://192.168.0.6/types}Promotion]
>[SOAPObjectBuilderGenerator: writing object builder for:
>calcPromotions]
>[SOAPObjectBuilderGenerator: writing object builder for:
>PromotionsRequest]
>[SOAPObjectBuilderGenerator: writing object builder for: Product]
>[SOAPObjectBuilderGenerator: writing object builder for:
>calcPromotionsResponse]
>[SOAPObjectBuilderGenerator: writing object builder for:
>PromotionsResponse]
>[SOAPObjectBuilderGenerator: writing object builder for:
>PromotedProduct]
>[SOAPObjectBuilderGenerator: writing object builder for:
>getPromotionProducts]
>[SOAPObjectBuilderGenerator: writing object builder for:
>getPromotionProductsResponse]
>[SOAPObjectBuilderGenerator: writing object builder for:
>PromotionProductsInStore]
>[SOAPObjectBuilderGenerator: writing object builder for:
>ProductInPromotion]
>[SOAPObjectBuilderGenerator: writing object builder for: getPromotions]
>[SOAPObjectBuilderGenerator: writing object builder for:
>getPromotionsResponse]
>[SOAPObjectBuilderGenerator: writing object builder for: Promotion]
>[SerializerRegistryGenerator: creating serializer registry:
>com.mcrl.promo.remote.PromotionsService_SerializerRegistry]
> [wsdeploy] error : com.sun.tools.javac.Main is not available in the
>classpath..
> [wsdeploy] error: compilation failed, errors should have been
>reported
>
>Total time: 5 seconds
>Finished at: Fri Mar 26 09:19:24 GMT 2004
> --- "Doug Kohlert Doug.Kohlert-at-Sun.COM |newsgroups|"
><bplchv58qj0t_at_sneakemail.com> wrote: > Does your system classpath have
>tools.jar in it from the jdk?
>
>
>>Ewan Harrow wrote:
>>
>>
>>
>>>Hi
>>>
>>>I am trying to migrate a jax-rpc project to maven from ant but have
>>>
>>>
>>hit
>>
>>
>>>a brick wall when running wsdeploy. Specifically wsdeploy throws a
>>>NPE. I used to have the same problem running wscompile from maven
>>>
>>>
>>but
>>
>>
>>>solved it by getting maven to use a different class loader.
>>>Unfortunatly the same trick does not work with wsdeploy. I have
>>>
>>>
>>though
>>
>>
>>>found the problem and it is where it tries to uses javac to compile
>>>
>>>
>>the
>>
>>
>>>generated classes but is getting the NPE as the following returns
>>>
>>>
>>null
>>
>>
>>>in JavaCompilerHelper.internalCompile():
>>>
>>>ClassLoader cl = Thread.currentThread().getContextClassLoader();
>>>
>>>I patched the code (see attachment) to set cl to the system
>>>
>>>
>>classloader
>>
>>
>>>if it is null so the NPE goes away but now I get a
>>>ClassNotFoundException for com.sun.tools.javac.Main.
>>>
>>>Ewan
>>>
>>>
>>>
>>>
>>>
>>>___________________________________________________________
>>>Yahoo! Messenger - Communicate instantly..."Ping"
>>>your friends today! Download Messenger Now
>>>http://uk.messenger.XXXXXXXXX/download/index.html
>>>
>>>
>>>
>>------------------------------------------------------------------------
>>
>>
>>---------------------------------------------------------------------
>>
>>
>>>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>>>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>>>
>>>
>>>
>>--
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>Doug Kohlert
>>
>>Sun Microsystems, Inc.
>>503-345-9806
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>NOTICE: This email message is for the sole use of the intended
>>recipient(s) and may contain confidential and privileged
>>information. Any unauthorized review, use, disclosure or
>>distribution is prohibited. If you are not the intended
>>recipient, please contact the sender by reply email and destroy
>>all copies of the original message.
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>>
>>
>>
>
>
>
>
>
>___________________________________________________________
>Yahoo! Messenger - Communicate instantly..."Ping"
>your friends today! Download Messenger Now
>http://uk.messenger.XXXXXXXXX/download/index.html
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>
>

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Kohlert
Sun Microsystems, Inc.            
503-345-9806  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information.  Any unauthorized review, use, disclosure or
distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy
all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net