• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem executing executable jar file

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have developed and successfully executed the server and client jar files on one machine and when I carried the same jar files to another machine where I tried to execute the server jar file on another machine, I am getting the following error messages.

Where am I going wrong ?
Thanks
Ravi
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi janapareddy,
It looks like you may not have the stubs in your jar. Is it possible that on the machine that works, that you are executing from a directory that has the stubs in its CLASSPATH and not on the other machine?
Hope this helps,
Michael Morris
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Maybe you can try to specify the
codebase.
@@ Herbert @@
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Originally posted by Herbert Christy:
Maybe you can try to specify the
codebase.


Not a good idea for this assignment. That generally only works when your server is running on a web server somewhere.

Michael Morris
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have the exact same problem. After searching for a long time, only one way worked for me....put stub classes in HTTP server.
However, as Michael said, it would not be a good idea ask the grader put the stubs in HTTP or FTP server... what if they don't have it on their testing machine..
I am trying to use codebase.....where should the stubs locate? Should I set CLASSPATH on the server machine?
Right now, I have "server.jar", which is an executable jar and includes all my server-side classes and stubs. "client.jar" is an executable jar, which includes all client-side classes. I tried this command line, the error is that client could not find my stub..... Maybe something wrong with my codebase property, could somebody please take a look?
Start Server:
E:\RMI>start rmiregistry
E:\RMI>java -Djava.security.policy=file:/e:\RMI\security.policy -jar server.jar
Start Client:
E:\RMI>java -Djava.rmi.server.codebase=file:/e:\RMI\server.jar -Djava.security.policy=file:/e:\RMI\security.policy -jar client.jar 198.192.0.40 1099 db.db
Then, I got error:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: server.ConnectionFactory_Stub
[ September 19, 2002: Message edited by: Sandra Baker ]
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
These are the contents of my FBNServer JAR file.

So I do have the stub in my jar so the only issue now seems to be that when I tried to execute the jar then I should have the stub in my classpath. I am now trying to focus on this issue ???
Any more hints ???
Thanks
Ravi
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ravi,
How are you starting the RMI registry? Is it possible that the registry does not have the necessary stubs in its CLASSPATH. If you are not starting the registry from your server, you should consider doing that since it will then have the same CLASSPATH as your application. Here's how you do it:

Hope this helps,
Michael Morris
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael
I start the rmi registry using the following command.
start rmiregistry
Now I have made the changes in setenv batch fike which sets the environment before I execute the server jar file.
The batch file reads
set JAVA_HOME=c:\jdk1.3.1
set PATH=%JAVA_HOME%\bin;%PATH%
set classpath=%classpath%;c:\submission\classes\FBNServer.jar;c:\submission\classes\FBNClient.jar;
but I am still getting the exception as before.
I shall try your command to start the rmi registry. Using the LocateRegistry.createRegistry(port); command I wonder how the rmiregistry will find the stubs in the classpath ?
Thanks
Ravi
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ravi,


I shall try your command to start the rmi registry. Using the LocateRegistry.createRegistry(port); command I wonder how the rmiregistry will find the stubs in the classpath ?


The stubs should be in your jar file. The CLASSPATH will be identical for both registry and jar. So if the jar can locate a class then the registry can also locate the same class. It's best not to depend on the CLASSPATH for this assignment. The only classes that your application should depend on, aside from the core Java classes, should all be in the jar file.
Hope this helps,
Michael Morris
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Micheal


The stubs should be in your jar file. The CLASSPATH will be identical for both registry and jar. So if the jar can locate a class then the registry can also locate the same class.


I have the stubs in the jar file. The only problem now appears to be that the jar file is not able to locate the stub class within. How do we make the jar file to locate the stub class within.
Thanks
Ravi
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ravi,
As long as your directory structure is the same in the jar file as it is in your package directories, that should be adequate. In other words if you have the following directories in your development space:

Then your jar file should have the same directory structure. If that's the case then there should be no problem locating any required class file from a jar context.
Hope this helps,
Michael Morris
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Micheal
It does not seem to be the problem in my case as I have my executable jar working on other machine.
Thanks
Ravi
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ravi,


It does not seem to be the problem in my case as I have my executable jar working on other machine.


Is it possible that on the working machine that the stubs are being loaded from the CLASSPATH and not thru the jar?

Michael Morris
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Micheal
I shall have to check it up this detail later in the evening since my working machine is at home.
I shall have to see whether I have setup any classpath in the settings -->control panel ---> Advanced - Environmental variables on the working machine but this is highly unlikely.
Thanks
Ravi
 
Sandra Baker
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, janapareddy
I had the same problem as yours, and now I think I solved it, just for your reference.
I made an executalbe server.jar, and put it under e:\Test\. The jar includes following folders:
- server: includes all server classes and stubs (my server main class is in this folder too)
- interface: includes all interfaces
- db: includes all Data related classes
Then, I specified codebase property like:
-Djava.rmi.server.codebase=file:/e:\Test\server.jar
Then, JVM will be able to find your stub classes in your executable jar......
Try this.... hope it will work for you.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandra
I shall try the codebase and hope it works for me.
I have checked my control panel setttings and there is no classpath settings for the JVM to automatically pick up on the stub.
Thanks
Ravi
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandra
I tried out the codebase and it has worked for me.
C:\submission\classes>java -jar -Djava.rmi.server.codebase=file:/C:\submission\c
lasses\FBNServer.jar FBNServer.jar
made connection to remote database
Server bound
Thanks
Ravi
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandra and Ravi,
I hate to be the bearer of bad news, but if you guys have to set the codebase for this assignment, you're asking for trouble. There is some issue with your jar files that is keeping the JVM from finding the necessary classes. You need to get this issue resolved. I'm sorry that I have not been much help on this but it is a very important matter that your jar files should be stand-alone executables.
Michael Morris
 
Sandra Baker
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael & Ravi,
Thanks very much for the information, and that's exactly what I was worried about.
I found out a way not need to specify codebase, however, it does not make much sense to me...
Here is what I tried, included all of the following files under e:\Test\
- server.jar (executalbe jar, includes all classes and folders I mentioned in my previous post)
- server folder (stubs are here)
- interface folder
I guess, this time, JVM directly go to server folder to find my stubs, not the jar executable file.
Does this sound reasonalbe to you? I feel somewhat redundant for having two copies of stubs under that same directory......
I did not touch any CLASSPATH....., is there a way to cleanup all CLASSPATH, becuase i want to make sure that there is no CLASSPATH that interferes with my testing.....
Thanks in advance....
[ September 20, 2002: Message edited by: Sandra Baker ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sandra,
You should have no dependencies whatsoever on class files outside the executable jar other than the core Java 2 classes. I don't know why you two are having trouble with your jars not being able to find some of the classes but you need to find out why.
What I did, was put every one of my classes in the jars in their proper directory to match their package. The only difference between my client.jar and server.jar was the Main-Class in Mainfest.mf in the meta-inf directory of the jar. Also verify that you have the proper import statements in your classes (like "import suncertify.server.*;") for any class that may depend on an external package. Make sure that you run rmic every time you change a Remote class and put the new stub in the jars. Another possible problem could have to do with any implied dependencies caused by using an IDE like Forte.
When all is said and done, you should be able to put your jar file on any machine with the right version of Java in any directory and it run without generating any exceptions regardless of how the CLASSPATH or codebase property is set.
Michael Morris
 
Sandra Baker
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael,
Thanks... I will keep trying to look into this....I was not expecting to experience "this pain" in this process
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I could run the executable jar file developed on one machine on another machine with success. I feel that you should have the right version of jdk on both the machines. I felt that my eariler problem was on account of difference in jdk version on the machines on which the test was carried out for eg my jdk version in home computer is jdk 1.3.1_04 whereas the jdk version on my work place computer was jdk 1.3.1_03. What I did I upgraded the jdk version on work computer to 1.3.1_04 and I developed the jars and took these jars to home computer where they ran without any problem.
I need to further test my theory my testing the same jar on still other machines.
Thanks
Ravi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic