This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes RMI Problem on java under Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Problem on java under Linux" Watch "RMI Problem on java under Linux" New topic

RMI Problem on java under Linux

Rajesh chintech

Joined: Feb 16, 2004
Posts: 9
I am trying to work a java RMI program(typical calculator) on my RedHat linux 8.0 machine. My java is J2SDK 1.4. I have compiled the interface, client, server, programs.
When I use rmic for the implementation file to create stub and skeleton, i am getting an error

rmic CalculatorImpl
at 0x4027812c: java.lang.Throwable.Throwable() (/usr/lib/
at 0x4026b0af: java.lang.Exception.Exception() (/usr/lib/
at 0x4026e9b3: java.lang.RuntimeException.RuntimeException() (/usr/lib/
at 0x4026e0a7: java.lang.NullPointerException.NullPointerException() (/usr/lib/
at 0x4022a547: _Jv_ThrowNullPointerException (/usr/lib/
at 0x4033099f: ?? (??:0)
at 0x4032ce5d: (/usr/lib/
at 0x4032bd25: (/usr/lib/
at 0x4032bc7c: (/usr/lib/
at 0x4032bb3b:[]) (/usr/lib/
at 0x40252308: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/ at 0x402bd0b1: (/usr/lib/
at 0x4025efdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/
at 0x4022b78c: _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/
at 0x4022b8ad: JvRunMain (/usr/lib/
at 0x080485a0: ?? (??:0)
at 0x420158d4: ?? (??:0)
at 0x080484ed: ?? (??:0)
Class path is provided correctly. All other programs including, servlets,JSPs, JDBC etc are working fine on linux. Is it the problem on linux. I need it to do in RMI only as it is in the University syllabus.
Please provide a help to me.......
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Doesn't sound good. Do you have another OS to try the rmic on? Can you post the exact command you are using or was that it? You might want to try adding the new version flag exactly like this:
rmic -v1.2 CalculatorImpl
the version flag has to be that, don't use the real version(like 1.4). Its really there to declare that you don't need the skeleton created since it is done automagicly with reflection on the client side in the newer versions of java. You can also use -keep in there and it will leave the generated java file that it creates the stub with. It's not really important, but it can be interesting to look at once to see how it looks.
Do you not have any packages that contain your CalculatorImpl? If you do, you have to declare them in the call like this:
rmic -v1.2 your.package.CalculatorImpl
You probably don't, or you would have used them. I just threw that in there just in case you forgot it.
Other than those things, I don't have a clue. As I see it, once you have checked these couple things I have mentioned here, you should try to take it to a different machine to see if somehow your SDK is messed up. I would try it on another linux and maybe a windoze if you have one available. Also might check with your Prof. They usually can give you some guides when something technical goes wrong. I mean you've got the code, they shouldn't give you a hard time if the tools you are supposed to use aren't working correctly.
Rajesh chintech

Joined: Feb 16, 2004
Posts: 9
Thanks for your reply, same error is generated, I want to do the RMI on Linux, because our institution does not have any other OS.
here is my full code, I want to implement a small calculator in Java using RMI, if it succeeds, i can go for some advanced programs. (is the interface)
public interface Calculator extends java.rmi.Remote {
public long add(long a, long b) throws java.rmi.RemoteException;
public long sub(long a, long b) throws java.rmi.RemoteException;
} (the implementation file)
import java.rmi.*;
import java.rmi.server.*;
public class CalculatorImpl
implements Calculator {
public CalculatorImpl() throws java.rmi.RemoteException {
public long add(long a, long b) throws java.rmi.RemoteException {
return a+b;
public long sub(long a, long b) throws java.rmi.RemoteException {
return a - b;
As per the information i got from suns manual, i tried to compile both these , and i succeed, then i need to create stub and skeleton using rmic.
Then the error generated earlier is obtained, even with option 1.2 the same error,
I think only after creating stub and skeleton, i should go for Naming, registry etc sections.
waiting for comments....
Thanks in advance
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
What version of java did you say you were using?1.4.? My only suggestion now is to try it with a different version. I'm not sure what else to tell you. The code looks fine to me. The errors you showed looks like its a problem within java itself since it never mentions your classes at all. If you can try it on a newer version it might make a difference. Oh, are you sure you are running rmic from the correct dirrectory ? I'm grasping at straws, but you need to run it from inside the directory that holds your class and call the full path with rmic. Try that. Otherwise, I don't have a clue. Hmm make sure you have write access to the directory you have the files in. I think that it actually writes the .java stub file to the directory holding the interface and then from that converts it to a class file. Perhaps that file isn't being written for some reason.
Are all your OS's mirror setups or were they setup by hand with some possibility of variation?
I'm clueless,
Rajesh chintech

Joined: Feb 16, 2004
Posts: 9
My java version is
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
My class path is correct, I m running the rmic from the directory the files are there, i tried with path provided explicitly too, and also with -v1.2 option.
the error is like that.
I have another requirement .
I would like to learn EJB. Simply a hello world application in EJB.
I downloaded j2sdkee1.3.1 for Linux. What are the steps to configure it and how can i run a simple EJB program.
please provide me the help for that....
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
I'm sorry, but I have no idea how to solve the problem. Try Sun's java newsgroups. Maybe someone there will have an idea. I don't know EJB either. Sorry.
Rajesh chintech

Joined: Feb 16, 2004
Posts: 9
i corrected the problem,.
i put explicit path
/usr/java/j2sdkxx/bin/rmic CalculatorImpl
where /usr/java/j2sdkxx is the path where java is installed.
thanks a lot
I agree. Here's the link:
subject: RMI Problem on java under Linux
It's not a secret anymore!