• 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

NX: Execute runme.jar with RMI

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I completed my assignment, I made a executable runme.jar for all class, including rmi stub and skeleton class, the manifest file is :
Manifest-Version: 1.0
Created-By: 1.4.2_04 (Sun Microsystems Inc.)
Main-Class: suncertify.start

But when I want to exceute the jar file, there is exception thrown out :
RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException: suncertify.server.DataServer_Stub

But DataServer_Stub.class is exactly contained in runme.jar, I don't know why. Thanks!
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your RMI stub files are not upto date with your compiled code. creat a new RMI stubs and it should work. I get that error whenver I forget to update my stubs files
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Inuka Vincit:
your RMI stub files are not upto date with your compiled code. creat a new RMI stubs and it should work. I get that error whenver I forget to update my stubs files



Use ANT to build your project, use it after every change and build all the way to the jar, that way you will do any compiles, rmic's, copies, and jars. Also you will have to restart the server after some RMI changes to the client.
 
Mike He
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Inuka Vincit:
your RMI stub files are not upto date with your compiled code. creat a new RMI stubs and it should work. I get that error whenver I forget to update my stubs files



I build the runme.jar with a batch file: Build.bat
rmic suncertify.server.DataServer
jar cmf mymanifest runme.jar suncertify

That means all the stub files are included in the jar package. Then I deleted the directory "/suncertify", it CAN NOT works any more and throw former exception.
Do I need submit my assignment with the directory "/suncertify"?
Thank in advance.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

I would suggest three things you should do.

First - provide us with a complete listing of files in your jar file (jar tvf runme.jar).

Second - provide us with the complete stack trace. The real problem might be somewhere else.

Third - try adding an extra blank line to the end of your manifest file (actually it doesn't sound like you are experiencing the bug that needs this, but it won't hurt ).

Regards, Andrew
 
Mike He
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help.

My MANIFEST file :

I add an extra blank line to the end, but problem still.
I build runme.jar with this manifest (jar vcfm manifest runme.jar /suncertify)

My Submission package file list is:

[ November 11, 2004: Message edited by: Mike He ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

My life list in runme.jar is:
META-INF/
META-INF/MANIFEST.MF
suncertify/
suncertify/SettingServer.class
suncertify/SettingServer$1.class



I had asked for the output of "jar tvf runme.jar", where the v would give verbose output similar to:



The advantage being that it then becomes possible to see file creation dates and file sizes.

If you extract this jar file into a clean directory does your submission work?

By the way - I put my sample output between [code] and [/code] tags - doing so helps preserve indenting, which makes it easier to read / make comments. When you post on this forum, there is a button just below the edit pane which will automatically add the [code] and [/code] tags to your post so you don't have to remember the tags.


My MANIFEST file :
Manifest-Version: 1.0
Created-By: 1.4.2_04 (Sun Microsystems Inc.)
Main-Class: suncertify.Dispatch



Hmmm - this is different from the manifest file you described earlier. I will assume that this makes no difference, and you have just changed it since your earlier post.

Do you start the RMI Registry from within your application, or do you start it from the command line?

Regards, Andrew
 
Mike He
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry,my mistake, misapprehend your meaning.


When I extract jar file into a new clean directory, it works.

If I delete the directory,it don't work any more.

Do I need provide you the jar file to check it?
[ November 11, 2004: Message edited by: Mike He ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike

Originally posted by Andrew Monkhouse:
Do you start the RMI Registry from within your application, or do you start it from the command line?



Originally posted by Mike He:
When I extract jar file into a new clean directory, it works.

If I delete the directory,it don't work any more.



Ahhh - now we are getting somewhere. The problem is that the RMI Registry does not know where your classes are.

Most candidates use the java.rmi.registry.LocateRegistry class to start the RMI Registry from within their application, rather than starting it manually the way you are doing it.

If you look at the Sun RMI Tutorial, in particular at the Running the Example Programs topic, you will see that a codebase and security policy need to specified on the command line in order for your applications to work with an externally started RMI Registry. You could try and work around these issues, but I suspect that doing so will be more trouble than it is worth, especially since you probably have instructions forbidding the use of command line options and forbidding the use of security managers.

Take a look at starting the RMI Registry from within your server application, and see if that solves your problems.

Regards, Andrew
[ November 13, 2004: Message edited by: Andrew Monkhouse ]
 
Mike He
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah,It works. Thank you.

But I don't know why RMI Registry can't locate the class in the jar "runme.jar" but can do in the directory "suncerty". I don't set codebase and security policy in both condition,but result is different.
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

But I don't know why RMI Registry can't locate the class in the jar "runme.jar" but can do in the directory "suncerty". I don't set codebase and security policy in both condition,but result is different.



When you start the RMI Registry manually, it will look in the current working directory for any class files or packages. That is why it works when you have unpacked your jar file.

However the RMI Registry will not look in any jar files or zip files or ear files or war files or rar files or .... My personal view is that this is reasonable - the RMI Registry is meant to be a server process, which you would ideally want to be able to start from any directory and have it up and running as fast as possible. You would not normally want to force it to start in a particular directory, nor would you want it to have a slow start up time while it goes through every potential file in the current directory trying to find out whether the file is needed or not. Nor would you want it keeping track of thousands of unneeded classes just because they happened to be in the current directory.

Personally I would be happier if the RMI Registry did not look for class or packages in the current working directory. Then the behavior would be consistent. But I can understand the way it currently works can be useful for testing.

Regards, Andrew
 
Mike He
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much,Andrew
I have passed 1.4 SCJD,with 346
General Considerations (maximum = 100): 93
Documentation (maximum = 70): 69
O-O Design (maximum = 30): 29
GUI (maximum = 40): 31
Locking (maximum = 80): 44
Data store (maximum = 40): 40
Network server (maximum = 40): 40

Locking part is not good, anyway, thank you fro your help

Mike
reply
    Bookmark Topic Watch Topic
  • New Topic