• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

SCJD RMI Practice

 
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi people,

I'm practicing some RMI concepts on a pc (lets call it pc A) a simple Hello World test for my SCJD. It works fine. The problem is when i try to start the client from another pc (pc B).

Steps on pc A (server):
-----------------------
I compile the server object, client object and interface.
I create the stub file using >rmic ServerImpl
I start the registry with >start rmiregistry.
I start the server.

note: in the client object i have the following:

HelloInterface server = (HelloInterface)Naming.lookup("rmi://192.168.0.3:1099/Server");

the ip address is the LAN ip of the server.

Steps on pc B (client):
-----------------------
Copy the generated client.class file from the server to the client (pc B).
I run the client and it says it cannot find HelloInterface (which is on the server (pc A).

note: the server is run with JRE 1.4 and the client runs with JRE 1.5.

Where am i going wrong?

Thanks in advance and regards,
Marzo.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working through my SCJD as well. I found there can be a lot of small gotchas. To start with, are you copying all the class files to the new server? And don't forget the stub files.

Matt
 
Marcelo Ortega
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All of the files are on the server, even the client, but then i copy the client.class file and put it in the client pc (pc B acording to my example) and try to run it.

Am i doing it the right way?

I'm getting the following error:

NoClassDefFoundError: InterfaceFile

It's like it can't find the remote interface file (or it can't find the stub over the LAN).

Thanks in advance,
Marzo.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
did you copy Your Remote interface (your compiled .class extention of the Remote interface that acts as the contract between the client and the server) and the stub file generated by rmic utility into PC B?
 
Marcelo Ortega
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually no, i didn't. Must i?
 
Matthew Baranowski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post the actual error? I expect that it is telling you that it cannot find the stub class.
 
Marcelo Ortega
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error i was first getting when i started the client was the folowing:

NoClassDefFoundError: interfaceFile

So then i copied both the compiled client.class file and the interface.class file to the client.

But now i get i security error. Client machine has JRE 1.5 and server has 1.4.

Any ideas?
 
Marcelo Ortega
Ranch Hand
Posts: 528
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not getting the security error any more because i copied the interface file AND the stub file to my client machine, now it runs like acharm.

Thanks and best regards,
Marzo.
 
He does not suffer fools gladly. But this tiny ad does:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic