rmiregistry must be started from within source path?

I'm experiencing pretty much the same problem that was described in this:

http://forum.java.sun.com/thread.jspa?forumID=58&threadID=174893

post, but I'm still confounded by it.

Here's my problem in a nutshell:

If I start rmiregistry from a point in my project classpath, I can then start my server with no problems. If I start rmiregistry from anywhere else, the server fails with:

EASSwitch exception:RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: EASClient.EASSwitchIface

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

...

I've tried all the stuff suggested, but I must be doing something wrong.

Here's what works:

I start rmiregistry from within my project location:

ed@falcon:~/src/workspace/EASServer/src$ rmiregistry &

[4] 2236

ed@falcon:~/src/workspace/EASServer/src$ java -jar ~ed/bin/EASServer2_fat.jar

server-> EASSwitch Server starting...

server-> EASSwitch is bound. Server Ready.

The server is started and running, ok.

But if I start rmiregistry from anywhere else I get:

ed@falcon:~/src/workspace$ rmiregistry &

[4] 2309

ed@falcon:~/src/workspace$ java -Djava.rmi.server.codebase=file:///home/ed/src/workspace/EASServer/src/EASRemote/ -classpath /home/ed/src/workspace/EASServer/src/ -jar ~ed/bin/EASServer2_fat.jar

server-> EASSwitch Server starting...

EASSwitch exception:RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: EASClient.EASSwitchIface

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: EASClient.EASSwitchIface

I've tried to change the codebase pointer to http and include the classpath on the command line also with no effect:

java -Djava.rmi.server.codebase=http://165.137.27.143/apache2-default/EASRemote_Stub.class -jar ~ed/bin/EASServer2_fat.jar

and

ed@falcon:~/src/workspace/EASServer/src$ java -Djava.rmi.server.codebase=http://165.137.27.143/apache2-default/ -classpath . -jar ~ed/bin/EASServer2_fat.jar

server-> EASSwitch Server starting...

EASSwitch exception:RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: EASClient.EASSwitchIface

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: EASClient.EASSwitchIface

The file EASRemote_Stub.class is in the apache2-default directory and in the filesystem location specified in the above examples.

Since I want to deploy this, i don't want to have to include the source code.

Thanks in advance,

Ed

[3434 byte] By [Edderda] at [2007-10-3 3:24:00]
# 1

Hi,

Think of a codebase like an additional classpath entry.

That means that the package structure must be omitted from the codebase property and it is expected to exist at the codebase location.

For a codebase that is a directory:

you run:

java -Djava.rmi.server.codebase=http://myserver/somedir/

there must exist http://myserver/somedir/mypackage/MyFileImpl.class and

possibly http://myserver/somedir/mypackage/MyFileImpl_Stub.class

For a codebase that is a jar file:

you run:

java -Djava.rmi.server.codebase=http://myserver/somedir/all_files.jar

the jar must include "mypackage/MyFileImpl.class" and possibly "mypackage/MyFileImpl_Stub.class"

When you run the registry its best to unsetenv CLASSPATH, so the registry will only rely on the codebase property and its behavior won't depend on its current directory.

Genady

genadya at 2007-7-14 21:16:40 > top of Java-index,Core,Core APIs...