I'm wondering if I'm the only one who has run into a weird classpath problem with rmi code and jar files. I have my project in a state where I am 1 error away from uploading it, but I'm having a problem starting the server from the jar file. When starting the server using the .class files directly, everything works great. If I attempt to start the server after jaring everything up I get this stack trace: <author> java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: suncertify.server.DataRemoteImpl_Stub java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: suncertify.server.DataRemoteImpl_Stub java.lang.ClassNotFoundException: suncertify.server.DataRemoteImpl_Stub at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:249) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:224) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:358) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at java.rmi.Naming.rebind(Naming.java:165) at suncertify.server.FBNServer.main(Unknown Source) </author>
I have no problems running the client from this jar, and the class file is definately in there - here's the jar tf for it: <author> 169>jar tf fbn.jar META-INF/ META-INF/MANIFEST.MF suncertify/ suncertify/client/ suncertify/client/BookFrame$BookingWatcher.class suncertify/client/BookFrame$BookListener.class suncertify/client/BookFrame.class suncertify/client/FlyByNight.class suncertify/client/PrimaryFrame$PrimaryListener.class suncertify/client/PrimaryFrame.class suncertify/client/ReservationFrame$ReservationListener.class suncertify/client/ReservationFrame.class suncertify/client/ReservationTableModel.class suncertify/client/WindowWatcher.class suncertify/db/ suncertify/db/Data.class suncertify/db/DatabaseException.class suncertify/db/DataInfo.class suncertify/db/FieldInfo.class suncertify/server/ suncertify/server/DataFactory.class suncertify/server/DataRemotable.class suncertify/server/DataRemoteImpl.class suncertify/server/DataRemoteImpl_Skel.class suncertify/server/DataRemoteImpl_Stub.class suncertify/server/FBNServer.class </author> I looked all over the sun java site to see if I'm missing a step when I jar rmic generated files, but I didn't see anything. Before resorting to voodoo spells, I wasn wondering if anyone had any insight on this issue. Thanks in advance for any assistance! B.
B Alexander If I am right, you need clarify two things first in order to find your problems 1. Did you use a seperate rmiregistery or a localregistry in your server class. These are diffierent. if use the formaer, then you need provide rmi server every information it needs like codebase, classpath etc. 2. when you did not pack your class files into a jar file, then your codebase default is classpath, but after you packed, classpath has no any meaning all to codebase. you may try redefine your classpath or codebase to include the jar file. if you use rmiregeistry, then try start your server application like following: classpath c:\you_jarfile_home\you_jarfile_name.jar or provide (......)codebase=c:\you_jarfile_home\you_jarfile_name.jar Hope it will help David
Joined: Mar 19, 2001
David - that is exactly what the problem was! Thank you! In looking at the matter, I found details published by sun at: this site which talks about all of the codebase issues. The quick fix is to set the classpath environment variable. Otherwise, you need to have the codebase referred to via the HTTP, which could be problematic and include it on the execution command line. If anyone else runs into this problem, try taking the -cp or -classpath argument out of your execution line, and set it prior to any executions (including the rmiregistry!). good luck everyone!
hi, Are we allowed to put remote host, port in a separate file and read from this file when the application comes up. is it ok to do that. Sun assignment says that our application should not require the examiner to edit any files... is it applicable for parameter files as well??? Your comments are appreciated. thanks
'Any files' probably includes a parameter file as well. And since it's easy to use command line parameters or even a small startup window for entering the data you really don't have to risk failure by doing exactly what SUN tells you not to do.. :-) Regards, Aron
Joined: Jan 27, 2001
hi, thanks, i felt the same way after i posted this message. in fact, i thought about it and pretty much changed all of my code already. Just another question. do we need to give commands for setting the classpath on different platforms . because, if i would like to add a particular folder to the existing classpath, i would do that in one of the two ways 1. change the classpath variable in the system manually . add the specific folder i need. or 2. run command somethign like set classpath=c:\folderToAdd;%classpath% (for windows) in this second format the existing classpath variable can be accessed differently on different platforms. Should we provide command lines for all the major platforms??? any thoughts thanks
Joined: Jan 28, 2001
Hi guys Has any of you used inner rmigegistry to start the server. I used it, and it saves me a lot to do with classpath or codebase. I just wonder if my approach is unpopular. David