Error running RMI program in Linux

hi,
hope can get some advices and help from you all..my problems is like this:
There is no problem when i run my RMI client in Windows to send message to server. but when i run my RMI client in Linux to send message to server, exception occurs..here are the source codes...
****interface Task2*****
public interface Task2 extends Serializable {
    Object getSender();
    Object getReceiver();
    Object getText();
}****sdMssg.class********
public class sdMssg implements Task2{
        Sring sender, receiver, text;
     public sdMssg(String s, String r, String t) {
             sender = s;
          receiver = r;
          text = t;
     public Object getSender(){
          return sender;
     public Object getReceiver(){
          return receiver;
     public Object getText(){
          return text;
}when i click "send" in my message box,
public void actionPerformed(ActionEvent e){
     if(e.getActionCommand().equals("Send")){
     try{
     String input = lsd2.getText(0, lsd2.getLength());
     String mssg = new String(sender.getText()+": ");
     mssg = mssg.concat(input);
     try{
          sdMssg task = new sdMssg(sender.getText(), receiver.getText(), mssg);                    
          uL.sendMessage(task); //uL is the reference to the remote 
                                   //object.sendMessage is remote
                                   //method to send task object to
                                   //server
     }catch(Exception ex){
          ex.printStackTrace();
     lsd.insertString(lsd.getLength(), mssg + newline, attrs);
     lsd2.remove(0, lsd2.getLength());
     }catch(BadLocationException ex){}************************************************************************
the exception : java.lang.NullPointerException() at line uL.sendMessage(task)..do you know what is the problem? it's running very well in Windows but not in Linux..what should i do? i really need yours help..
Thanks a lot here..

sorry, it's my mistake..it really Naming.lookup problem..i have solved it..anyway, thanks for your kindness..

Similar Messages

  • Run java program on linux

    Hi All
    I'm beginner with linux
    I have java program and I can run it in windows7 with bat file
    jre1.6.0_04\bin\java -classpath "..\classes"  database_com.Main_Class 7778
    pauseI want to run this program in linux but I can't
    I try run this program with bat file :
    /java-1.5.0-gcj-4.3-1.5.0.0/bin/java -classpath "../classes"  database_com.Main_Class 7778
    pauseplease help me

    Ora-dbaabode wrote:
    I want to run this program in linux but I can'tImagine you have a splitting headache and decide to go to the doctor. You come into his (or her) office and say, Doc, I'm not feeling to well. The doctor replies and asks, well, what seems to be the problem? You reply: "well, I just don't feel too good". See where I'm getting at (hint: missing details!).
    As for your JDK, I highly, no, I very highly recommend you get rid of GCJ and install Sun's JDK. This may very well be the source of your problems. GCJ is a pain in the @ss!

  • Error running old programs

    IE: java xxxx gives me a class not found error. OK, restart. Same error. The programs I'm running I've run hundreds of times before. Java doesn't recognize any java classes actually. I'm going to reinstall, but has anyone run into this before? Oh yeah, I'm running 1.3. ( Reinstalling the latest one). Thanks in advance.

    Goddammit. I just wrote a reply, and clicked preview and closed the window without posting. Grrr...
    Anyway, I had the same problems with IE. You need to disable Sun Java:
    Tools -> Internet Options -> Advanced
    Scroll down to "Java (Sun)"
    Disable the checkbox "Use Java 2 v1.4.1_02 for <applet> (requires restart)
    And ignore it, it doesn't require a restart (at least not for me). If the box is checked (using Sun Java), most applets don't work. I uncheck it, they all work.
    HTH,
    Radish21

  • Error running java program (testing oracle-character-set-31 against ab?c )

    Hi
    When i run my java program from eclipse , i get these errors : how to correct these errors and run the program
    testing oracle-character-set-31 against <ab?c>
    PASSED LOSSY
    testing oracle-character-set-31 against <XYZ>
    PASSED LOSSY
    testing oracle-character-set-31 against <longlonglonglong...>
    PASSED LOSSY
    testing oracle-character-set-870 against <abc>
    PASSED
    testing oracle-character-set-870 against <ab?c>
    PASSED
    testing oracle-character-set-870 against <XYZ>
    PASSED
    testing oracle-character-set-870 against <longlonglonglong...>
    PASSED
    testing oracle-character-set-871 against <abc>
    PASSED
    testing oracle-character-set-871 against <ab?c>
    PASSED
    testing oracle-character-set-871 against <XYZ>
    PASSED
    testing oracle-character-set-871 against <longlonglonglong...>
    PASSED

    rxg wrote:
    Hi
    When i run my java program from eclipse , i get these errors : how to correct these errors and run the program
    ...Sun's not Oracle (yet). You will have better luck on a forum relating to whatever is producing that "oracle-character-set..." output.
    Edit:
    Although a Google search for "testing oracle-character-set" yields only this thread. Are you sure that output isn't part of your program?
    Edited by: endasil on 7-Oct-2009 3:40 PM

  • Error running client program

    c:>java HelloClient
    Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/logging/LogO
    utputStream
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:124)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
    extFactory.java:118)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    71)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
    at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    at HelloClient.main(HelloClient.java:17)
    I am gettting the following error when run the client program
    i am using weblogic 5.1
    the code is HelloClient.java
    import java.rmi.RemoteException;
    import java.util.Properties;
    import javax.ejb.CreateException;
    import javax.ejb.RemoveException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    public class HelloClient {
    public static void main(String [] args) {
    try {
    Properties props=new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL,"t3://localhost:7001");
    InitialContext ctx = new InitialContext(props);
    Object ref = ctx.lookup("helloBean.HelloHome");
    HelloHome hello1 =
    (HelloHome)PortableRemoteObject.narrow(ref,HelloHome.class);
    Hello1 helloHome = hello1.create();
    String message = helloHome.getMessage();
    System.out.println("messsage from Bean====" +message);
    // helloHome.remove(); //clean up
    catch (NamingException ne){
    ne.printStackTrace();}
    catch (Exception exception) {
    System.err.println("Exception!");
    exception.printStackTrace();}
    Hello1 is remote interface
    HelloHome is home inteerface
    the bean is deployed
    anyone please help
    i hava added c:\weblogic\classes\weblogic\logging in classs path
    but the same problem occured.

    Try addinging weblogic.jar to the classpath.

  • Error Running jar file on Linux Server

    Hi,
    I recently wrote a small program to be run together when apache is being start up on the server. When the bin/startup.sh is executed, my program will be run together
    exec java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
    I included this command in the startup.sh but the following error came up when I run it:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/btsoft/magic/zip/ZipFile
    I placed the jar file in the same directory as the startup.sh.
    But when I run it directly on the console:
    java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
    its fine..
    Can anyone help me with this problem?
    Thanks

    williammandrake wrote:
    I placed the jar file in the same directory as the startup.sh.That would suggest to me that your directory is wrong. I suggest you start by printing out cwd.
    Could also be a permissions problem as well.

  • Error running any program

    Hi guys, new to the forum here, just as I'm new to Java. I'm trying to get my Java environment running, but everytime I execute the code, I get an error message saying
    "Exception in thread "main" java.lang.NoClassDefFoundError: TestJavaEnvironment"
    If anyone has any ideas what I'm doing wrong, I'd greatly appreciate it, got some homework for a class I'm taking, but talk about stumbling out of the gate. Anyways, thanks in advance.

    Assuming that you have created a file named
    "TestJavaEnvironment.class", change to the directory that contains it. From that directory issue the following command:
    java -cp . TestJavaEnvironment
    Important: include the period and the surrounding spaces.

  • Running java program on linux

    I wrote quite nice (I think so) program in java and I'd like to write bash script to run this java program, so I wrote:
    #!/bin/bash
    java lecznica
    lecznica it's the main class of my program.
    When I running this script from shell, everything is OK, but, when I've made desktop shortcut to this script -it doesn't work. Why? Tell me another thing how to add information about additional packages with java libraries. The -classpath option doesn't work.

    Maybe your question was misunderstood:
    the classpath option only tells your interpreter where to find the libraries in your filesystem.
    You still need to inform the compiler which packages you are using in your class using the import directive.
    For example;
    import com.lion.DrawRect;                  // tells the compiler that we will be using DrawRect from package com.lion
    ...and
    java -classpath \opt\include\java\libs\RectLib.jar footells the compiler to run the class foo, and to look in \opt\include\java\libs\RectLib.jar to search for classes.

  • Run C program compiled for Linux on Mac x11?

    Hi,
    Is it possible to run a c-code program compiled for Linux on x11? If this is not possible, is there a way to have a linux platform runninn os 10.6.8 so I can use these programs?
    I knew little about Linux or X11, so I don't know if it is possible or how to recompile the program for x11.
    Thanks!

    Linux compile code will not run on Mac OS X, and even if you violated the Mac OS X license to run Mac OS X in virtual machine on top of Linux, the Mac environment would still not run the Linux program.  The Linux program needs to run on Linux.
    If your Linux program is X11 based, then it is possible to run the program on Linux and have the output displayed on your Mac.   Start an Applications -> Utilities -> Terminal session, and run the command
    ssh -Y [email protected]
    LinuxPrompt> run_your_Linux_program
    The ssh -Y will establish an X11 DISPLAY tunnel between your Mac and the Linux system.  When you run an X11 based app on the Linux system via this ssh session, the X11 display output will be sent back to the Mac.
    NOTE:  Many Open Source programs have Mac OS X ports.  Sometimes there are actual Mac OS X binaries, and sometimes you have to build them yourself.  There are also services that will do the heavy lifting of installing a ported Open Source app, such as MacPorts.org and FinkProject.org

  • External program under Linux

    hello
    how run external program under Linux OS from my java application ?

    You need Runtime.exec() and you can save yourself a lot of grief and time by reading http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html.
    Once you have read it, read it twice more!

  • Basic RMI program works in windows but not Linux

    Hello,
    I'm trying to learn RMI for a program at work.
    I have the book "Core Java 2 - Volume 2 - Advanced Features". Chapter 5 of this book is about RMI.
    The most basic example program they use works fine in Windows. However, when I try to run this same program under linux it doesn't work.
    For now, I'm not even trying to run a client (in linux)...just the server.
    Here is the server code.
    public class ProductServer
    public static void main(String args[])
    try
    System.out.println
    ("Constructing server implementations...");
    ProductImpl p1
    = new ProductImpl("Blackwell Toaster");
    ProductImpl p2
    = new ProductImpl("ZapXpress Microwave Oven");
    System.out.println
    ("Binding server implementations to registry...");
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    System.out.println
    ("Waiting for invocations from clients...");
    catch(Exception e)
    e.printStackTrace();
    What is very interesting is that this call works
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    But the very next line
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    Throws this error ::
    java.rmi.UnmarshalException: Error unmarshaling return header: java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:221)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:366)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:133)
    at java.rmi.Naming.rebind(Naming.java:172)
    at ProductServer.main(ProductServer.java:35)
    I would very much appreciate the help. Thank You.

    We solved the problem
    Apparently, on the linux machine we had both gcc and the jdk installed
    the regualar compile command hit the jdk
    the rmic command used the gcc version of rmic
    the rmiregistry used the gcc version of rmiregistry
    the regular run command hit the jdk
    using the rmic and rmiregistry in the jdk made everything work fine
    I knew it had to be a stupid answer.

  • Firefox will not open on my computer, even after reinstall, with no error message or when I try to run "C:\Program Files\Mozilla Firefox\firefox.exe" -p. Help?

    I recently installed firefox so I could use an adblocker. It installed just fine, and it worked just fine for about three days. Then yesterday it stopped opening. I'm on a Toshiba running Windows 7. The icon highlights when I click on it, but then it stops and won't open the browser at all. When I try to run it with the manual command "C:\Program Files\Mozilla Firefox\firefox.exe" -p, I get the error message, "C:\Program Files\Mozilla Firefox\ refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location." I installed it to that location, and I don't need a disk. I'm connected to the Internet just fine and my other browsers (Chrome and IE) work the same as always. But they're swamped with ads and I really was happy wih Firefox when it was opening...how can I fix this issue?

    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Java RMI program error

    Dear friends,
    I am running an RMI example program,
    have used rmic to generate the stub and skeleton class, have used rmiregistry 1010 to start registry service, and used java Pi to start the server, but there are errors generated as follows,
    Error --java.rmi.UnknownHostException: Unknown host:Default; nested exception is:
    java.net.UnknownHostException:Default
    java.rmi.UnknownHostException: Unknown host:Default; nested exception is:
    java.net.UnknownHostException:Default
    java.net.UnknownHostException:Default
    at java.net.InetAddress.getAllByName0(Unknown Source)
    at java.net.InetAddress.getAllByName0(Unknown Source)
    at java.net.InetAddress.getByName(Unknown Source)
    at java.net.Socket.<init>(Unknow Source)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknow Source)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknow Source)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknow Source)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknow Source)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknow Source)
    at sun.rmi.server.UnicastRef.newCall(Unknow Source)
    at sun.rmi.registry.Registry_Stub.bind(Unknow Source)
    at java.rmi.Naming.bind(Unknown Source)
    at Pi.main(Pi.java:23)
    the program codes are as follows,
    //server interface
    import java.rmi.*;
    interface PiRemote extends Remote {
    double getPi() throws RemoteException;
    //server
    import java.net.*;
    import java.rmi.*;
    import java.rmi.registry.*;
    import java.rmi.server.*;
    public class Pi extends UnicastRemoteObject
    implements PiRemote {
    public double getPi() throws RemoteException {
    return Math.PI;
    public Pi() throws RemoteException {
    public static void main(String[] arguments) {
    System.setSecurityManager(new
    RMISecurityManager());
    try {
    Pi p = new Pi();
    Naming.bind("//Default:1010/Pi", p);
    } catch (Exception e) {
    System.out.println("Error -- " +
    e.toString());
    e.printStackTrace();
    //client
    import java.rmi.*;
    import java.rmi.registry.*;
    public class OutputPi {
    public static void main(String[] arguments) {
    System.setSecurityManager(
    new RMISecurityManager());
    try {
    PiRemote pr =
    (PiRemote)Naming.lookup(
    "//Default:1010/Pi");
    for (int i = 0; i < 10; i++)
    System.out.println("Pi = " + pr.getPi());
    } catch (Exception e) {
    System.out.println("Error -- " + e.toString());
    e.printStackTrace();
    who know how to resolve the problem, thank you in advance:)

    I do always use the ip adress/port
    You can find it by
    try {
         ipLocal = InetAddress.getLocalHost();
         catch(Exception e) {
              new PopUpMessage("ERROR","Error in searching IP", true);
    system.out.println("Your IP address is " + ipLocal.getHostAddress());

  • Problem running a simple Hello World RMI Program

    I wrote a simple RMI application, consisting of a Server Interface, Server Implementation and a Client.
    Since the codes are really small, am pasting them here so that you could identify the problem if any, in the code.
    1. Server Interface......
    import java.rmi.* ;
    public interface HelloInterface extends java.rmi.Remote
         public void sayHello(String arg) throws RemoteException ;
    2. Server Implementation......
    import java.rmi.* ;
    import java.rmi.server.* ;
    public class HelloImpl extends UnicastRemoteObject implements HelloInterface
         public HelloImpl() throws RemoteException
              super() ;
         public void sayHello(String arg) throws RemoteException{
              try{
                   System.out.println("RMI Program : Hello "+arg) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
         public static void main(String[] args) throws RemoteException
              try{
                   if( System.getSecurityManager() == null )
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloImpl impl = new HelloImpl() ;
                   Naming.bind("HelloService",impl) ;
                   System.out.println( "Service bound..." ) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
    3. Client Code.
    import java.rmi.* ;
    import java.rmi.Naming.* ;
    class RMIClient
         public static void main(String[] args)
              try{
                   if(System.getSecurityManager()==null)
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloInterface helloInt = (HelloInterface) Naming.lookup("rmi://sand.cise.ufl.edu/HelloService") ;
                   helloInt.sayHello("Ranjit") ;
              catch(Exception e){
                   e.printStackTrace() ;
    I have double checked the classpaths and they all look fine..
    I have even unset the classpath from the shell which runs the rmiregistry..am still getting these errors..
    1. If i use the default java to run the application..this is the error that it spits..
    sand:24% java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:110)
    at HelloImpl.main(HelloImpl.java:28)
    Caused by: java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
    ... 3 more
    2. Using java from some other location..the error looks different...but in both cases it just gives errors :((
    sand:25% /usr/java1.2/bin/java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:116)
    at HelloImpl.main(HelloImpl.java:28)
    I am embarking on a huge assignment but if am having problems getting started..
    Your help will be highly appreciated..
    thanx and regards
    Ranjit Iyer

    First of all you should be posting this Q in the RMI forum :)
    You are getting that error because your stub is not in your clients classpath (or u can say the compiler is not able to find it).
    Make sure that the file HelloImpl_Stub is in the client classpath/package.
    Regards
    Meka Toka

  • "Error determining planning periods for calendar "  when running a program

    Hi,
    When i am running a program with date range say "01/05/2011" to "30/06/2011",the program is executing successfully without any error. When i am executing the same program with date range as a) "01/05/2009" to "30/06/2011" and b)"01/05/2008" to "30/06/2011" the program is failing with error as "Error determining planning periods for calendar". Can anyone suggest me what i should do to avoid the failure of the program with above date ranges also.
    Thanks in advance,

    Dear,
    Error message 61123:"Error determining planning periods for calendar &".The PPC planning calendar specified in the material master MRP 2 view for the material is  incorrectly.
    The planning calendar periods are insufficiently maintained for the planning calendar used.
    Check the period of planning calendar in MD26 and generate the correct period.You can avoid the problem in several ways:
    Maintain the planning calendar far enough in the future (at least until beyond  the end of the planning horizon).
    Also check any demand is lies beyond the validity period of planning calendar.
    Reduction of the planning horizon of MRP also can control such issue, as MRP planning horizon lies in an area in which the planning calendar is no longer maintained
    Regards,
    R.Brahmankar

Maybe you are looking for