• 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

Starting the RMI server on Windows

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am just trying to use the three files in suns tutorial: http://java.sun.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html

Hello.java - a remote interface
Server.java - a remote object implementation that implements the remote interface
Client.java - a simple client that invokes a method of the remote interface

I have started the rmiregistry by running "start rmiregistry" in the java bin directory. There is no output in this window, i hope this is correct.

But when I try to run the server I get the following message:



I'm suspecting it having to do with the codebase parameter that I have omitted. But even if I try to add it I can't seem to figure out a way for it to start.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mikael Månsson wrote:I have started the rmiregistry by running "start rmiregistry" in the java bin directory. There is no output in this window, i hope this is correct.


Yes.

And regarding your exception, how did you try to run the server program (i.e: what command) ? How is your class files are organized?
 
Mikael Månsson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are all located in the same default package.

Considering this, what would be the correct way to run the server?
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm suspecting it having to do with the codebase parameter that I have omitted. But even if I try to add it I can't seem to figure out a way for it to start.


Mikael Månsson wrote:They are all located in the same default package. Considering this, what would be the correct way to run the server?


You should add the codebase when running the server. As the tutorial says just put the absolute path to the directory where your classes are located (this case as you are using default package). It should work.
 
Mikael Månsson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, but for the submission to the SCJP, where you deliver a jar file, what is then the preferred way?

Lets say I have the following structure:



Say that the remote object and server is in remote and the rmi client is in local. I will use the same jar on both machines but with different startup options. How do i specify the codebase when I start the application? Can it be omitted, since the class files are available locally anyway?
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can specify a URL of a JAR in a codebase where classes are organized in correct package hierarchy. And if you are using same JAR in both server & client side then you don't need RMI.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic