File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes problem while running applicaiton through jar commands........ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "problem while running applicaiton through jar commands........" Watch "problem while running applicaiton through jar commands........" New topic
Author

problem while running applicaiton through jar commands........

jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Hi,
I created client.jar and server.jar files. In client.jar I inlcuded the stub files also with directory structure. In the server.jar also I includes stub & skel files. I even gave the correct manifest files in both jars..and the executing the server.jar like below..
start rmiregistry 9999
java -Djava.security.policy=mysecurity.policy -jar server.jar db.db 9999
I am getting following exception:::
Exception: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: suncertify.server.DataServerInterfaceImpl_Stub
where DataServerInterfaceImpl is the main class in starting the server.
where as the above command executes fine, if I extract the server.jar first before starting the server by using the following command..
jar -xf server.jar
I am feeling that it's not the correct way of running the jar files..where as, client .jar working fine with out extracting that. Why it is happening for server.jar only that too I am providing all files necessary for it's executing with directoy structure..
Please help me out from here..
Thanks a lot..


jyothi
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

It sounds like you have an RMISecurityManager class in your server and that is what is stopping your jar from running.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Hi Mark,
Yeah, previously my source code had that RMISecurityManager..but now I removed that code and executed again..
but even then it's not working...What might be the reason for that??
Thanks in advance..
[ November 15, 2002: Message edited by: jyothi sunke ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Now run the server jar like
java -jar server.jar <<any arguments here>>
no need for a policy file now.
Mark
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Hi Mark,
I executed with out policy file, now above exception is not coming but I am experiencing some other problem...
It is giving following exception..
Exception: access denied (java.io.FilePermission db.db read)
I checked the properties of file and it is not read only file..I didn't understand the problem...
Today I am experiencing lot of wierd problems while executing the application..
Thanks in advance..
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Jyothi,
check whether you have installed a security manager, either programmatically or as a command line argument. Remove the security manager, and try again.
Hope this helps.


Mag
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Hi Mag & Mark,
What do u mean by installing the security manager?? I have following code on server side before binding the object in Naming service..
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
previously I set SecurityManager before lookup on client side also.. Now I removed on client side..
Except that I nowhere installed the SecurityManager...
IS this correct???
Thanks in advance...
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Jyothi,
exactly this piece of code - just remove it and try again.
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Mag,

I tried that also..This time I am getting the following exception again..
Exception: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: suncertify.server.DataServerInterfaceImpl_Stub..
If I keep this code, on server side I am not getting this exception and at that situation I am getting db.db read only exception..What Should I do Mag???
Thanks a lot for ur help..
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I tried that also..This time I am getting the following exception again..

Now package your stubs in your client jar, and everything will work.
Eugene.
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
First of all, server is not starting..How can I execute client with out starting the server..I didn't understand...
Thanks...
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
Hi,
I understand that problem is in Manifest file
and in setting the class path.
Manifest-Version: 1.0
Main-Class: suncertify.server.DataServerInterfaceImpl
Created-By: 1.2.2 (Sun Microsystems Inc.)
In this, I am trying to give Class-Path also..but I didn't find any difference in the result.
So, how to set Class-Path in Manifest file..
Thanks in advance..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Where are you running your jar files from.
If you have c:\devexam\suncertify\server your jar should reside in the c:\devexam directory. Actually in the jar file the class files have the paths included, in the paths it should not have c:\devexam, it should have suncertify\server in it's path, which means you create your jars from the c:\devexam directory.
Mark
 
jQuery in Action, 2nd edition
 
subject: problem while running applicaiton through jar commands........