0

Every thing works just fine as both the Client and server runs on the same system,, but as i run one of them on a remote m/c,well i am using vmware for that, Client is not able to locate server's stub and server is not able to locate clients classes for dynamic loading..

I am sure its an issue with the way i set the codebase url's but how should i change them.

presently, i set them as

file:/E:/surshikradmin/workspace/rmi-server/bin/ for server..

and kind of same way for client.. should i add the host name too,,but how??? Any help would be highly helpful since its been years i am dealing with issue and solving it will make ma project go rock..

Client side stack trace if it coul help!

Computeappengine exceptionerror unmarshalling return; nested exception is: 
java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at Client.computeappprog.main(computeappprog.java:23)
 Caused by: java.lang.ClassNotFoundException: Engine.ComputeappEngine_Stub
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:432)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:163)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
... 2 more
pcc
  • 81
  • 1
  • 1
  • 8

1 Answers1

0
  1. The codebase system property is set at the JVM which has the classes that are also available via the codebase: usually, the server. Its purpose is to tell the JVMs that don't have the classes where to find them. Setting it at those JVMs has no effect.

  2. It has to be set to a value which will have a meaning to the peer. So a file or directory on the exporting JVM's own filesystem won't work, because the peer can't see that file.

  3. That's why codebase URLs are usually http: URLs. You can use a file: URL if it names a shared drive, by its sharename, but if you're inside a LAN I don't really see why you would need to use the codebase feature at all.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • 1.codebase is also set at client if server is supposed to dynamically load classes from client,correct me if i am wrong.. 2.a shared drive might work but what if ma client and server are connected over internet,,would a shared device work then,,or making a rmi project forces you to owning a site.. – pcc Jul 03 '13 at 06:27
  • (1) is included by what I said. Read it again. I spoke about JVMs that are exporting remote objects, not about servers and clients at that point. (2) Shared file systems don't work over the Internet. That's why I mentioned HTTP. (3) I don't know what your last phrase means. – user207421 Jul 03 '13 at 09:39
  • ma last phrase simply mean that if i mention codebase url as something like HTTP://url.com,, then their has to be some site where i put my shared source code,,which means i must use some website to build a project that works over internet..I cannot build a successful rmi project without using a webserver providing the shared code.is that so??? – pcc Jul 03 '13 at 11:06
  • You're already providing an RMI server that has to work over your network. Adding a web server to that is trivial. – user207421 Jul 03 '13 at 11:22
  • well it worked on shared folders very well but now ma problem simply turns to two different hosts over internet..thanx @EJP cz only cz of your shared folder idea, i could see it working for the first time,,now please help me by answering ma above question in comment...i am not providing any rmi server,i created it inside my servers jvm,by Locateregistry.createregistry(1099);,,what should i do in that case? – pcc Jul 03 '13 at 11:41
  • Of curse you're provide an RMI server. That's what the question is about. Every remote object you export, including the Registry, is an RMI server. If you have it working with shared folders, I really don't know what it is you're asking me here. – user207421 Jul 03 '13 at 11:46
  • it worked with shared folders because both my systems are connected using a lan..if they were connected over internet,it wouldn't have worked..no rmi server is provided,my server and rmiregistry share the same jvm if i created my registry using Locateregistry.createregistry(1099) instruction.i confirmed it from task manager.Now i dont have any website where i can put my shared classes.is there anyway i can get ma project running without using a webserver?? are you getting me?? – pcc Jul 03 '13 at 12:04
  • @EJP I think the client has resolving problem, maybe she/he doesn't set the -Djava.rmi.server.hostname or permission issues, I tested the code, it works well –  Jul 03 '13 at 13:43
  • So what's the question? If you're using the Internet you have to use an HTTP (or FTP) codebase. We've been over all that. – user207421 Jul 03 '13 at 23:49