You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-user@xml.apache.org by Brian Dobby <bd...@nobilis.com> on 2002/06/24 12:50:51 UTC

RE: NullPointerException on server close (solved)

Hi, folks. 
I found the problem: I was calling 'start' on the WebServer, and this
method is called internally to start the thread. Thus two threads were
sharing the same WebServer instance; no wonder it didn't work! Maybe a
note in the doc would help avoid other newbies falling for this one?
   Thanks 
     Brian


-----Original Message-----
From:	Brian Dobby
Sent:	Fri 6/21/2002 7:31 AM
To:	rpc-user@xml.apache.org
Cc:	
Subject:	NullPointerException on server close
Hi, I'm just trying xmlrpc for the first time. I'm impressed with its
ease of use, but I do have one problem with it; I always get a null
pointer exception reported when the WebServer closes, and this doesn't
look good in a production system. 

I create the WebServer like this:
   myserver = new WebServer(m_apiPort);
   myserver.addHandler("MyRPC", myClass);
   myserver.start();

I stop it like this:
   myserver.removeHandler("MyRPC");
   myserver.shutdown();

I get this at the console:
Closing XML-RPC server socket.
Exception in XML-RPC listener loop (java.net.SocketException: Socket
closed).
Closing XML-RPC server socket.
Hit uncaught exception java.lang.NullPointerException
java.lang.NullPointerException
	at org.apache.xmlrpc.WebServer.run(WebServer.java)
	at java.lang.Thread.run(Thread.java:484)

This happens whether or not I actually run a client. I'm running with
JDK 1.3 under Windows 2000 Server. Does anyone know what I'm doing
wrong?

   TIA
      Brian






Re: NullPointerException on server close (solved)

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jason van Zyl will be removing the implicit start() for the next
release of XML-RPC.  Ought to obviate the need for any special
documentation.

- Dan

"Brian Dobby" <bd...@nobilis.com> writes:

> I found the problem: I was calling 'start' on the WebServer, and this
> method is called internally to start the thread. Thus two threads were
> sharing the same WebServer instance; no wonder it didn't work! Maybe a
> note in the doc would help avoid other newbies falling for this one?
>
> -----Original Message-----
> From:	Brian Dobby
> Sent:	Fri 6/21/2002 7:31 AM
> To:	rpc-user@xml.apache.org
> Cc:	
> Subject:	NullPointerException on server close
> Hi, I'm just trying xmlrpc for the first time. I'm impressed with its
> ease of use, but I do have one problem with it; I always get a null
> pointer exception reported when the WebServer closes, and this doesn't
> look good in a production system. 
>
> I create the WebServer like this:
>    myserver = new WebServer(m_apiPort);
>    myserver.addHandler("MyRPC", myClass);
>    myserver.start();
>
> I stop it like this:
>    myserver.removeHandler("MyRPC");
>    myserver.shutdown();
>
> I get this at the console:
> Closing XML-RPC server socket.
> Exception in XML-RPC listener loop (java.net.SocketException: Socket
> closed).
> Closing XML-RPC server socket.
> Hit uncaught exception java.lang.NullPointerException
> java.lang.NullPointerException
> 	at org.apache.xmlrpc.WebServer.run(WebServer.java)
> 	at java.lang.Thread.run(Thread.java:484)
>
> This happens whether or not I actually run a client. I'm running with
> JDK 1.3 under Windows 2000 Server. Does anyone know what I'm doing
> wrong?
>
>    TIA
>       Brian

Re: NullPointerException on server close (solved)

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jason van Zyl will be removing the implicit start() for the next
release of XML-RPC.  Ought to obviate the need for any special
documentation.

- Dan

"Brian Dobby" <bd...@nobilis.com> writes:

> I found the problem: I was calling 'start' on the WebServer, and this
> method is called internally to start the thread. Thus two threads were
> sharing the same WebServer instance; no wonder it didn't work! Maybe a
> note in the doc would help avoid other newbies falling for this one?
>
> -----Original Message-----
> From:	Brian Dobby
> Sent:	Fri 6/21/2002 7:31 AM
> To:	rpc-user@xml.apache.org
> Cc:	
> Subject:	NullPointerException on server close
> Hi, I'm just trying xmlrpc for the first time. I'm impressed with its
> ease of use, but I do have one problem with it; I always get a null
> pointer exception reported when the WebServer closes, and this doesn't
> look good in a production system. 
>
> I create the WebServer like this:
>    myserver = new WebServer(m_apiPort);
>    myserver.addHandler("MyRPC", myClass);
>    myserver.start();
>
> I stop it like this:
>    myserver.removeHandler("MyRPC");
>    myserver.shutdown();
>
> I get this at the console:
> Closing XML-RPC server socket.
> Exception in XML-RPC listener loop (java.net.SocketException: Socket
> closed).
> Closing XML-RPC server socket.
> Hit uncaught exception java.lang.NullPointerException
> java.lang.NullPointerException
> 	at org.apache.xmlrpc.WebServer.run(WebServer.java)
> 	at java.lang.Thread.run(Thread.java:484)
>
> This happens whether or not I actually run a client. I'm running with
> JDK 1.3 under Windows 2000 Server. Does anyone know what I'm doing
> wrong?
>
>    TIA
>       Brian