• Post Reply Bookmark Topic Watch Topic
  • New Topic

App won't run when client is on a different machine than server - $donation

 
Josh Davidson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I�m trying to get this fairly small and simple RMI application to work. I�m at my wit�s end right now and after many hours of fiddling, I seem to be no closer to the solution. Whoever is the first to suggest a solution to this problem can choose their favorite open source group which will receive a $20 donation. Otherwise, it is going to Gaim or Firefox.

The problem is that I have this application that works great when it is running on multiple VM�s on the same machine, but when the client is moved to a different workstation, I receive the following exception (stack trace) when starting the client.




This is how it is started:



I am using the ClassFileServer provided by Sun to distribute the stub files. I will list out code, minus the ClassFileServer code (it IS contained in the zip below) followed by the compilation commands below. However, you may find it easier to just grab the source here (compile.txt lists all the compilation and run commands):
http://www.msu.edu/~joshd/project.zip
Note that if you are going to try and run the project, you need to change the hostname in Naming.lookup in the Client.java file to the hostname of your machine running rmiregistry. Please forgive the sparse comments. I had to retype all of this from printouts, and I have a broken wrist. The just of the program is it creates a RemoteFactory object that sits between a server and client program. The client makes requests to the RemoteFactory to create new RemoteDataObjects. These RDOs are sent to an accept method (implements FactoryListener interface) on the Server that created the RemoteFactory and then returned to the client.


Anyways, I am now going to list the code by package in this order:
datavis.shared, datavis.server, and datavis.client
All of the classes and interfaces are separated into files of the same name, but for simplicity I will list them grouped here.

/*datavis.shared*/



/*datavis.server package*/





/*package datavis.client*/




Ok, and here is how I compile if that matters:

javac -d webserver -classpath webserver -sourcepath . examples\classServer\ClassFileServer.java

javac -d classes -classpath classes -sourcepath . datavis\server\DataEngine.java

javac -d classes -classpath classes -sourcepath . datavis\client\Client.java

rmic -d classes -classpath classes datavis.server.Remote2dDataObjectImpl

rmic -d classes -classpath classes datavis.server.RemoteFactoryImpl
 
Kedar Bhawarthi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The problem is that I have this application that works great when it is running on multiple VM�s on the same machine, but when the client is moved to a different workstation, I receive the following exception (stack trace) when starting the client.

It seems problem with rmi client who is not getting stub class:
Because you are running your client well with command�
java -Djava.security.policy=policy.all -classpath classes davis.client.Client
where you had set your classpath to classes directory ( i assume stub and skeletons are there only) your client program easily get stub file
But which arrengment you do and how you invoke your client when you separate it on different workstation ( how you ensure that it has an access to stub classfile)
As a solution you should provide datavis.server.RemoteFactoryImpl_Stub to clients classpath; for that you may choose to copy it on client's workstation
OR
Use that 'codebase' trick for dynamic class loading on client machin as you have used to invoke DataEngine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!