java - RMI with multiple JAR inclusion -
I am coding an RMI program with 3 JAR:
- RMIServer, in it Server-side classes are
- RMIClient has client side classes
- There are servers in RMIResource & amp; Client shared content (interface, custom exception)
To create a separate JR file, I created 3 projects in NetBan, then I declared the shared jar in another's "Library / Build" section 2 Projects
Everything is just build-up OK, no error.
But when I try to launch the server through the command line, insert the files shared in a separate jar, it is a pain in the sudden ** ...
Here are a few examples of the commands given here:
-
Using a doublepassword server, pointing to the server resources, but using dual codebase
Java cp ~ / NetBeansProjects / RMIServer / dist / RMIServer.jar -Djava.rmi.server.codebase = "file: /home/myuser/netbeansprojects/rmiserver/dist/rmiserver.jar file: / home / myuser / Netbe Ansprojects / rmiserver / dist / lib / rmiresource.jar "rmiserver.shop
Result:
network exception: java .rmi.ServerException: Remote Exclusion Server happened in thread; The nested exception is: java.rmi.UnmarshalException: error unmarshalling logic; The nested exception is: java.lang.ClassNotFoundException: rmiresource.BookingManager ...
-
Using dual syllables, but keeping codebase to point to server resources
java -cp "~ / NetBeansProjects / RMIServer / district / RMIServer.jar; ~ / NetBeansProjects / RMIServer / dist / lib / RMIResource.jar" -Djava.rmi.server.codebase = file : / Home / MyUser /netbeansprojects/rmiserver/dist/rmiserver.jar rmiserver.shop
Result:
thread Exception in "main" Java.lang.NoClassDefFoundError: done by rmiserver / Shop: java.lang.ClassNotFoundException: rmiserver.shop ...
-
Dual cell Text & amp; Dual codebase
java -cp "~ / NetBeansProjects / RMIServer / district / RMIServer.jar; ~ / NetBeansProjects / RMIServer / dist / lib / RMIResource.jar" -Djava.rmi.server.codebase = "file: /home/myuser/netbeansprojects/rmiserver/dist/rmiserver.jar file: /home/myuser/netbeansprojects/rmiserver/dist/lib/rmiresource.jar" rmiserver.Shop
Result:
Exceptions in thread "main" java.lang.NoClassDefFoundError: Shop made by: rmiserver / java.lang.ClassNotFoundException: rmiserver.Shop .
EDIT: I am working on a local computer, imitating a remote connection. In this way I use the 'File' protocol and not 'http'.
Am I missing something? Thanks for any help
I check my first solution again because it was the most promising:
java -cp ~ / netbneansprojects / rmiserver / district / RMIServer.jar -Djava.rmi.server.codebase = "file: /home/myuser/netbeansprojects/rmiserver/dist/rmiserver.jar file: /home/myuser/netbeansprojects/rmiserver/dist/lib/rmiresource.jar" Rmiserver .hop
It still failed.
Then I tested on Windows:
-
rmiregistry setup empty square path (and CD in the Java / bin directory) with one
set CLASSPATH = "";
And ... it worked!
I reconstructed the cleanliness / solution both Linux & amp; Windows and it's still not working on Linux and is working on Windows ... I use the same Netbeans version on both!
Can anyone tell me? I am using JDK6 on Linux; JDK 7 on Windows: Will it have the effect?
One file: Can not work with codebase Local machine You must use HTTP, You can use: URL indicates in a shared directory, as the URL understands on the client, but it will not work outside the LAN.
The RMI registry requires access to shared classes through your classpages unless you are using the codebase feature: rmiregistry -J-Dclasspath = ... this is from LocateRegistry.createRegistry () Easy to use, then it is in the same JVM as your remote object and uses the same class path as the course. / P>
-
-
-
-
Comments
Post a Comment