This content has been marked as final. Show 4 replies
I want to deploy it by single jar fileWhy? Why would you deploy the RMIProgram server class to the client? That's none of its business.
but when I run this program. program throws exception ClassNotFound RMIServer.RMIProgram_stub.That's because the client needs the stub, and also the interface. So there's something wrong with the way you've packaged the JAR file. Incidentally the first listing you gave doesn't contain the stub: are you sure it isn't this one that fails?
What you need is actually three JAR files: one for the server, containing only the server class; one for only the client, containg the client class; and one which is common to both, containg the remote interface and the stub.
Thank you for your post.
Your answer is useful for me, but I'm not so familiar with deploy rmi program with jar. So I need further help.
According to your post. I think I need deploy my program like this:
-----Common ----------RMIInterface.class ----------RMIProgram_Stub.class -----RMIClient ----------RMIClientpro.class
Is it right?
-----RMIServer ----------RMIProgram.class -----Common ----------RMIInterface.class ----------RMIProgram_Stub.class
But when I run the jar file, there's still throw NoClassFoundException of the stub
I think it's to do with the manifest.mf file, it seems there are some more contents needed in the manifest.mf file.
I create the jar package by Netbeans, so the contents of MANIFEST.MF like this:
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 11.0-b15 (Sun Microsystems Inc.) Main-Class: RMIServer.RMIProgram Class-Path: X-COMMENT: Main-Class will be added automatically by build
But when I run the jar file, there's still throw NoClassFoundException of the stWhen doing what? Exporting the server? Binding it to the Registry? Looking it up in the Registry? Executing a remote method?
It makes a difference ...
Most probably it is the Registry that can't find the class. Start the Registry with -J-classpath = the client JAR file.