RMIC proxy stub compiler problems

E

ebby83

Hi all,
I am trying to compile the proxy and stub for the following Calendar
file

package com.ebby.server.process;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import com.ebby.server.objects.Event;
import com.ebby.server.objects.Group;
import com.ebby.server.objects.TimeRange;
import com.ebby.server.objects.User;

public class Calendar extends UnicastRemoteObject implements ICalendar
{

protected Calendar() throws RemoteException {
super();
// TODO Auto-generated constructor stub
}

public Event[] retreive_event(User u, TimeRange t) { // from ICalendar
// TODO Auto-generated method stub
return null;
}

public boolean schedule_event(Group g, TimeRange t, boolean publice) {
// from ICalendar
// TODO Auto-generated method stub
return false;
}

}

I use the following command to generate the files .

C:\Documents and Settings\workspace\WS>rmic -d . -classpath .
com.ebby.server.process.Calendar

But this produces only 1 stub file and no proxy(skel) file . Can any
one help me out with this.
 
T

Thomas Fritsch

Hi all,
I am trying to compile the proxy and stub for the following Calendar
file
[...]
public class Calendar extends UnicastRemoteObject implements ICalendar
{ [...]
}

I use the following command to generate the files .

C:\Documents and Settings\workspace\WS>rmic -d . -classpath .
com.ebby.server.process.Calendar

But this produces only 1 stub file and no proxy(skel) file . Can any
one help me out with this.
This behaviour is OK. In Java1.2 Sun has changed the internal RMI
implementation, so that only the stub class (Calendar_Stub in your case)
is needed, and the skeleton class (Calendar_Skel in your case) is no
longer needed.
If you, for whatever reason, must generate Java1.1-compatible stub and
skeleton, you can do it with "rmic -v1.1 ...".
If you don't have to be Java-1.1-compatible you use "rmic -v1.2 ..." or
simply "rmic ...".
See also http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/rmic.html
(at the very bottom).
 
E

ebby83

Thanks tom ,
although I cant get the server started. I compiled the Calendar_Stub
and then implemented a calendar Manager class

package com.ebby.server;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import com.ebby.server.process.Calendar;

public class CalendarManager {

public static Calendar getCalendar(String uname) {

return null;
}

public static void init() throws RemoteException {
Calendar c = new Calendar();
try {

// LocateRegistry.createRegistry(1099); // done through the prompt
by
// start rmiregistry
Naming.rebind("http://localhost:1099/CalendarMan", c);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

public static void main(String[] args) {
try {
CalendarManager.init();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}

I also set the codebase property of the rmi server as
-Djava.rmi.server.codebase=file:///C:/Documents%and%Settings/Ebrahim%Bandookwala/workspace/WS

I get the following error

java.net.MalformedURLException: invalid URL scheme:
http://EBBY:1099/CalendarMan
at java.rmi.Naming.parseURL(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at com.ebby.server.CalendarManager.init(CalendarManager.java:31)
at com.ebby.server.CalendarManager.main(CalendarManager.java:41)
 
T

Thomas Fritsch

although I cant get the server started. I compiled the Calendar_Stub
and then implemented a calendar Manager class
[...]

// LocateRegistry.createRegistry(1099); // done through the prompt by
// start rmiregistry
Naming.rebind("http://localhost:1099/CalendarMan", c);
You have to use
Naming.rebind("//localhost:1099/CalendarMan", c);
as described in
<http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/Naming.html>.
You may also use
Naming.rebind("rmi://localhost:1099/CalendarMan", c);
although it is documented there.
[...]
I get the following error

java.net.MalformedURLException: invalid URL scheme:
BTW: scheme is the terminus technicus for the URL part before "://", in
your case "http".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top