AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NullPointerException with JWSDP's wsdeploy

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Ben Horsfield
Guest





PostPosted: Mon Jul 18, 2005 11:29 am    Post subject: NullPointerException with JWSDP's wsdeploy Reply with quote



Hi all,

I've been trying to write a simple web service using JAX-RPC, however I'm
having trouble getting wsdeploy to create a cooked WAR file from a raw WAR
file.

The error I'm getting is:

Error: java.lang.NullPointerException
java.lang.NullPointerException
        at
com.sun.xml.rpc.tools.wsdeploy.DeployTool.defineServletsAndListeners
(DeployTool.java:447)
        at
com.sun.xml.rpc.tools.wsdeploy.DeployTool.run(DeployTool.java:258)
        at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43)
        at com.sun.xml.rpc.tools.wsdeploy.Main.main(Main.java:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)

Below is a description on how I arrive at this error.

::: Environment

SuSE 9.1, Kernel 2.4.21-273-default
jdk-1.5.0_04
jre-1.5.0_04
jwsdp-1.6

::: Interface

package CarPartReq;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface CarPartRequestIF extends Remote
{
    public String getCarPartRequest(String s) throws RemoteException;
}

::: Implementation

package CarPartReq;

import java.rmi.Remote;
import java.rmi.RemoteException;

public class CarPartRequestImpl implements CarPartRequestIF, Remote
{
    public String getCarPartRequest(String s)
    {
        if (s.equals("Engine 1"))
        {
            return new String("Engine 1 is currently out of stock.");
        }
        else
        {
            return new String("Your requested engine is in stock.");
        }
    }
}

::: WEB.XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
    <display-name>CarPartRequest</display-name>
    <description>Car Parts Order System</description>
</web-app>

::: JAXRPC-RI.XML

<?xml version="1.0" encoding="UTF-8"?>

<webServices
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/dd"
    version="1.0"
    targetNamespaceBase="urn:carpartreq/wsdl"
    typeNamespaceBase="urn:carpartreq/types"
    urlPatternBase="/ws">

    <endpoint
        name="CarPartRequest"
        displayName="CarPartRequest Service"
        description="A simple web service"
        wsdl="/WEB-INF/CarPartRequest.wsdl"
        model="/WEB-INF/model.gz"
        interface="CarPartReq.CarPartRequestIF"
        implementation="CarPartReq.CarPartRequestImpl"/>

    <endpointMapping
        endpointName="CarPartRequest"
        urlPattern="/CarPartRequest"/>

</webServices>

::: Compiling

I use an Ant script to compile the classes. This gives me:

../index.html
../WEB-INF/jaxrpc-ri.xml
../WEB-INF/web.xml
../WEB-INF/classes/CarPartReq/
        CarPartRequestImpl.class
        CarPartRequestIF.class

I then use wscompile (-define and -gen:client), which gives me:

../WEB-INF/model.gz
../WEB-INF/CarPartRequest.wsdl
../WEB-INF/classes/CarPartReq/
        CarPartRequest_Impl.class
        CarPartRequestIF_getCarPartRequest_ResponseStruct.class
        CarPartRequest_SerializerRegistry.class
        CarPartRequest.class
        CarPartRequestIF_getCarPartRequest_ResponseStruct_SOAPSerializer.class
        CarPartRequestIF_getCarPartRequest_RequestStruct_SOAPBuilder.class
        CarPartRequestIF_getCarPartRequest_RequestStruct.class
        CarPartRequestIF_Stub.class
        CarPartRequestIF_getCarPartRequest_ResponseStruct_SOAPBuilder.class
        CarPartRequestIF_getCarPartRequest_RequestStruct_SOAPSerializer.class

I create an uncooked WAR file by using:

jar cvf CarPartRequest-raw.war ${build_folder}

Then, I use wsdeploy to create a cooked WAR file:

wsdeploy -o CarPartRequest.war CarPartRequest-raw.war

And THAT is when I get the exception I mentioned above.

Has anyone else encountered this problem before? What could be causing it?
Am I overlooking anything horribly obvious?

Regards,
Ben

--
Ben Horsfield
www.ohthewit.com
Back to top
Ben Horsfield
Guest





PostPosted: Mon Jul 18, 2005 1:14 pm    Post subject: Re: NullPointerException with JWSDP's wsdeploy Reply with quote



Righto, for anyone who is having the same problem, the solution turns out to
be fairly simple.

WEB.XML needs to be extended a bit:

[...]
<web-app>
    <display-name>CarPartRequest</display-name>
    <description>Car Parts Order System</description>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>

It would seem that JWSDP_1.6 needs the <session-config> element to be
specified.

Regards,
Ben

--
Ben Horsfield
www.ohthewit.com

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.