• 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

RMI Problem on java under Linux

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
java.lang.NullPointerException
at 0x4027812c: java.lang.Throwable.Throwable() (/usr/lib/libgcj.so.3)
at 0x4026b0af: java.lang.Exception.Exception() (/usr/lib/libgcj.so.3)
at 0x4026e9b3: java.lang.RuntimeException.RuntimeException() (/usr/lib/libgcj.so.3)
at 0x4026e0a7: java.lang.NullPointerException.NullPointerException() (/usr/lib/libgcj.so.3)
at 0x4022a547: _Jv_ThrowNullPointerException (/usr/lib/libgcj.so.3)
at 0x4033099f: ?? (??:0)
at 0x4032ce5d: gnu.java.rmi.rmic.RMIC.generateStub() (/usr/lib/libgcj.so.3)
at 0x4032bd25: gnu.java.rmi.rmic.RMIC.processClass(java.lang.String) (/usr/lib/libgcj.so.3)
at 0x4032bc7c: gnu.java.rmi.rmic.RMIC.run() (/usr/lib/libgcj.so.3)
at 0x4032bb3b: gnu.java.rmi.rmic.RMIC.main(java.lang.String[]) (/usr/lib/libgcj.so.3)
at 0x40252308: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/libgcj.so.3) at 0x402bd0b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
at 0x4025efdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
at 0x4022b78c: _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.3)
at 0x4022b8ad: JvRunMain (/usr/lib/libgcj.so.3)
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.......
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
HTH
Chris
 
Rajesh chintech
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Calculator.java (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;
}
CalculatorImpl.java (the implementation file)
import java.rmi.*;
import java.rmi.server.*;
public class CalculatorImpl
extends
java.rmi.server.UnicastRemoteObject
implements Calculator {
public CalculatorImpl() throws java.rmi.RemoteException {
super();
}
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
rajesh
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
Chris
 
Rajesh chintech
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My java version is 1.4.2.02
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....
thanks
rajesh
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Chris
 
Rajesh chintech
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i corrected the problem,.
i put explicit path
like
/usr/java/j2sdkxx/bin/rmic CalculatorImpl
where /usr/java/j2sdkxx is the path where java is installed.
thanks a lot
rajesh
reply
    Bookmark Topic Watch Topic
  • New Topic