RMI NullPointerException
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Klearhos_Klearhou
Posted On:   Monday, July 15, 2002 07:34 AM

Hi, all here is my problem. I have a server and 2 clients for testing purposes. They are communicating through RMI. When I run them under the same host (without localhost but with real IP address) they run fine. The clients used to be applications that I tranformed them to applets. I tested the applications to 3 systems with WinXP both Home and Proffessional Edition In 1 out of three I took the exception: java.lang.NullPointerException at com.TavliGame.Interface.Interface.setmessagetext(Interface.java:550) at com.TavliGame.Interface.Communicator.settext(Communicator.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Metho   More>>

Hi, all


here is my problem. I have a server and 2 clients for testing purposes.


They are communicating through RMI.
When I run them under the same host (without localhost but with real IP address) they run fine.


The clients used to be applications that I tranformed them to applets.


I tested the applications to 3 systems with WinXP both Home and Proffessional Edition


In 1 out of three I took the exception:
java.lang.NullPointerException
at com.TavliGame.Interface.Interface.setmessagetext(Interface.java:550)
at com.TavliGame.Interface.Communicator.settext(Communicator.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.TavliGame.Interface.Communicator_Stub.settext(Unknown Source)
at com.TavliGame.Brain.game.rollToSeeWhoPlayFirst(Game.java:408)
at com.TavliGame.Brain.Game.run(Game.java:294)
at java.lang.Thread.run(Unknown Source)



Now that I have tranformed them to applets I took 2 out of 2 tests this NullPointerException!


In other words in the box that used to run when it was a normal application, now that it is an applet it raises that exception.


I could think that has to do something with the sandbox probably.


Inside the source code this sounds very wierd!
Here is a part of code that the exception is raised:
public int rollToSeeWhoPlayFirst() throws RemoteException
{
System.out.println("1.5 Communicator1 & com2 are " + communicator1 + ", " + communicator2);
if ( rollAgain == false )
{
/*
* First of all ask form both players to press teh Start button
*/

System.out.println("2. Communicator1 & com2 are " + communicator1 + ", " + communicator2);
communicator1.setText("Please press
the Start to begin
the game");
communicator2.setText("Please press
the Start to begin
the game");
communicator1.setStart( new Boolean( true ));
communicator2.setStart( new Boolean( true ));
communicator1.setTakeItBackEnabled( new Boolean( false ));


At the System.out.println(....)
the server DOES not print NULL but the normal object, and then when it tries to send the message through the stub the exception is raised.


Any ideas about where the error is would be very appreciated ?

   <<Less

Re: RMI NullPointerException

Posted By:   Klearhos_Klearhou  
Posted On:   Monday, July 15, 2002 08:05 AM

Sorry, the problem has been solved.
About | Sitemap | Contact