Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem running client.jar executable

 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created two executable jar files in root directory of my assignment: client.jar, server.jar. I include stub classed in client.jar.
I got the following exceptions trying to connect
to the server:

I could run my application without using executable jars. I am wondering what's wrong
with it.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I could run my application without using executable jars.

I had the same problem. This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.
The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar
Eugene.
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is likely because you forgot to include the subs and/or remote interfaces in your client jar. When you ran your client as a class, it could find the stubs from the classpath, but when you run it from the jar, there is no classpath.

I included stubs from server package, and interfaces from db package. About the classpath and executable jars, can you elaborate more on this? This may be the problem I have.

The other thing to make evrything easier is to start rmi from within your application, so that you don't need to set codebase, policy, or security manager.
My client start is as simple as
java -jar client.jar

You mean start rmi using LocateRegistry without using codebase, policy and security manager? I
have a policy file in my root directory, a manifest file for either client or server, and I start rmi in command line before I start server.

I used the same command as you did. I could start my server like this:
java -jar server.jar
but my client crashes with the above exceptions,
even I run it from my assignment root directory
which contains jar files. Whats wrong? Any guidance?
[ July 02, 2002: Message edited by: Holmes Wong ]
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gosh, I guess several threads are asking this same question. Any expert opinions?
 
Alex Gregory
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Alex. Thats a great tip, it solved my problem.
Originally posted by Alex Gregory:
Holmes Wong, make sure that if you put your stubs and skels inside server.jar you add this to your manifest file when you jar the client jar file.
Class-path: server.jar
Hopefully this was your problem solver.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic