Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with RMI & jar

 
Alex Gregory
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys, unfortunately I still cant get my jars and rmi to work together, after spending the whole night. I'm really stuck 100%.
I followed some people's suggestion to use LocateRegistry.createRegistry(), and everything works before I run my programs from jars.
And when I work with the jars I get: classNotFound exceptions of stubs.
to recap, my directory structure is :
c:\scjd\starting\suncertify\db\
c:\scjd\starting\suncertify\client
c:\scjd\starting\suncertify\server
and when I jarred i created server.jar which has *.class from db and server, and client.jar which has *.class from db and client.
I run the server.jar like this:
java -Djava.security.policy=test.policy -jar server.jar %1 %2
This works fine, but client.jar is what gives the exceptions:
java -Djava.security.policy=test.policy -jar client.jar %1 %2 %3
I'm really drowning here, please help me, I never knew that submitting this thing would be so hard, nothing is easy here, so please help, because all i have left to do is this packaging, otherwise im done.
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to have the *.stub files in your client.jar. Also check that your classpath is correctly set. If you have to use the cobebase argument
Hope this helps
 
Alex Gregory
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whole point of using LocateRegistry was to eliminate the need for codebase, and why set the classpath since we are using jars?
Also, right now I have the stubs and skels in both client and server jar? But in non jar way I only have stubs and skel in server and everything works. Please please help'
 
Alex Gregory
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After about 21 hours and a migraine, I found out my problem. When people kept saying to use classpath with manifest i didnt know how to do it. But here it is:
Class-path: server.jar
Thus, I only keep my stubs and skeletons in the server.jar, and add the following line to the client.jar manifest file. Thanks for the people who tried to help me, I know this will help others so they dont spend time like me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic