Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI start error

 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recive this error when i am trying to start my server:
Server starting at 10.10.4.50
Error creating server RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.server.DataFactoryImpl_Stub
This my code:

I have not any securitymanager and policyfile.
I start my application with java -jar server.jar
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the stub actually in your server.jar file, you can check it out in winzip and see if you find that class, and also check the path to make sure it says suncertify/server
It just appears that it can't find the class in the jar file.
Also remember that these stub classes will also need to be in the client.jar file too.
Mark
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the stub actually in your server.jar file,.

Yes it is.
and also check the path to make sure it says suncertify/server

Yes it is that in the server.jar
It just appears that it can't find the class in the jar file.

Ok, i understand

Also remember that these stub classes will also need to be in the client.jar file too

I have both stub and skel in server.jar and stub in client.jar. Is that ok?
If I add '-Djava.rmi.server.codebase=file:///F:\Privat\mina_projekt\cert\proj
ect\project\FlyByNight\dist/server.jar' when i start upp the application like this:
java -djava.rmi.server.... -jar server.jar it works!
Is my classpath wrong or something? I want to start without the codebase stuff.
Thnaks Mark
Any idea?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you should not need a codebase. Basically a codebase states where to find classes. If the classes are already in your jar file then it does not need to know the location.
It still appears like a class is missing in your jar file or a class has the wrong directoy path. When you create the jar file you should create from the root directory. for instance you have the following two source directories, with the .class files
c:\devexam\suncertify\db
c:\devexam\suncertify\server
then in the c:\devexam directory you would run
jar -cvfm server.jar c:\devexam\manifest\server\manifest.mf suncertify\db\*.class suncertify\server\*.class
Hope that helps
Mark
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
This is what i do:
F:\Privat\mina_projekt\cert\project\project\FlyByNight\classes>jar -cvfm ..\dist
\server.jar Manifest.mf suncertify\db\*.class suncertify\server\*.class suncerti
fy\util\*.class
Then:
F:\Privat\mina_projekt\cert\project\project\FlyByNight\dist>java -jar server.jar
Server starting
Server starting at 10.10.4.50
Server ended with the following error:
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: suncertify.server.DataInterfaceFactory
Impl_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.server.DataInterfaceFactory
Impl_Stub
java.lang.ClassNotFoundException: suncertify.server.DataInterfaceFactoryImpl_Stu
b
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at suncertify.server.DataInterfaceFactoryImpl.startServer(Unknown Source
)
at suncertify.server.DataInterfaceFactoryImpl.<init>(Unknown Source)
at suncertify.server.FBNServer.main(Unknown Source)
Yes, the server.jar contains the DataInterfaceFactoryImpl_Stub.
The command works fine:
F:\Privat\mina_projekt\cert\project\project\FlyByNight\dist>java -Djava.rmi.serv
er.codebase=file:F:/Privat/mina_projekt/cert/project/project/FlyByNight/dist/ser
ver.jar -jar server.jar
Server starting
Server starting at 10.10.4.50
Server ready at 10.10.4.50/FBNServer
I just dont get it.....
Any idea?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Naming.rebind("//" + daServer + "/" + SERVER_NAME, this);"
Well we can tell that this is the line that is failing.
this is showing up as an Unknown Source. That is about all I could figure out here.
What class has your main(String[] args) method?
Nevermind try this.


No need to have the server address. I think, I didn't have it in mine.
Hope this works, otherwise I am out of ideas.
Mark
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, that didnt do it. :-(
I have class called FBNServer (that has thr main method) that does new on DataInterfaceFactoryImpl.
Like this:

and
I just dont get it.
Thanks for all your help.
[ April 01, 2003: Message edited by: Raffe Paffe ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

have class called FBNServer (that has thr main method) that does new on DataInterfaceFactoryImpl.
...
Naming.rebind(SERVER_NAME, this);

What should be bound to registry is the remote object. In your case, it would be DataInterfaceFactoryImpl. Instead, you are trying to bind FBNServer.

String daServer = InetAddress.getLocalHost().getHostAddress();

Just curious, what does "daServer" name stand for?
Is that meant as a joke, kind of "red neck English"?
Eugene.
 
Daryl Fong
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you are staring using java -jar server.jar, you'll need to specify the classpath in the META-INF/MANIFEST.MF's class-path.
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you are staring using java -jar server.jar, you'll need to specify the classpath in the META-INF/MANIFEST.MF's class-path.

What do you mean? This is my manifest:

I ahve tried many combinations with classpath but nothing happends....any idea?
What should be bound to registry is the remote object. In your case, it would be DataInterfaceFactoryImpl. Instead, you are trying to bind FBNServer.

No i am not. I was unclear. The startServer method is in the DataInterfaceFactoryImpl class.
Just curious, what does "daServer" name stand for?
Is that meant as a joke, kind of "red neck English"?

Hiphop man, just hiphop slang from the 80! :-)
Yest its a joke. I put da infront of all temporary names.
Thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raffe here is my manifest for the client and for the server. Maybe that will help.
Server

Client

Both of the classes listed as the Main-Class is the class that has the
public static void main(String[] args) method in them.
Mark
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both of the classes listed as the Main-Class is the class that has the
public static void main(String[] args) method in them.

Are those calsses the the remote ones?
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there r two ways to solve the problem
first.
try set classpath="your work class" or jar;
then run rmiregistry in command line,
and startserver with

second.
u can make rmiregistry in the programme ,by useing

wish it could be help
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yest its a joke. I put da infront of all temporary names.

Are you serious? Do you think the folks at Sun Microsystem would understand your sense of humor?
Eugene.
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yup, this dis it. Set the classpath to server.jar before starting the rmiregistry.
Thanks.
Are you serious? Do you think the folks at Sun Microsystem would understand your sense of humor?
Eugene.

Well, i will remove it before posting it to Sun...
:-)
Thank you all for your help!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic