RMI Server Starting pblm in Linux

Hi,
When i'm starting to run my RMI application in linux which is showing an error...
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.net.SocketException: Connection reset
But this same programe easly can run in windows

Just see the administration guide. There is a section for starting and stopping both the inf and midtier components via command line or using the GUI.

Similar Messages

  • JDK6 And ClassNotFound Exception during RMI server start

    Hello,
    I have been write a simple Hello World RMI, but I'm unable to start the server always get this exeception:
    Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
         java.lang.ClassNotFoundException: rmi.Hello
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
         java.lang.ClassNotFoundException: rmi.Hello
         at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
         at sun.rmi.transport.Transport$1.run(Transport.java:159)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
         at java.lang.Thread.run(Thread.java:619)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
         at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
         at rmi.HelloMain.main(HelloMain.java:21)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)The sources are these:
    package rmi;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface Hello extends Remote {
        public void sayHello() throws RemoteException;
    package rmi;
    import java.rmi.RemoteException;
    public class HelloServer implements Hello{
        public HelloServer() {
            super();
        public void sayHello() throws RemoteException {
            System.out.println("Ciau!");
    package rmi;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.rmi.server.UnicastRemoteObject;
    public class HelloMain {
        public static void main(String[] args) {
         try {
             Hello obj = new HelloServer();
             Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
            // Bind the remote object's stub in the registry
            Registry registry = LocateRegistry.getRegistry();
            registry.bind("Hello", stub);
            System.err.println("Server ready");
        } catch (Exception e) {
            System.err.println("Server exception: " + e.toString());
            e.printStackTrace();
    }May be I'm wrong with start command, but I tried differents syntax without result.
    Can you help me?
    Thanks to all.
    PS:Sorry for my spaghetti-english :D

    I had similar issue and i got rid of it by doing the following:
    i. Start rmiregistry from the server code (so that the JVM remains the same) like this
    // Server.java
    Process pro = Runtime.getRuntime().exec("rmiregistry 1099 &");
    // ... ii. Use java.rmi.server.codebase property while starting the server
    D:\rmiEx\bin>java -Djava.rmi.server.codebase=file:/D:\rmiEx\bin example.hello.Server

  • Server starting problems on Linux

     

    I am installing, painfully, WebLogic 5.1 under RedHat 6.1 as I write this
    and it has been a disaster.
    (Note: I had done several WebLogic on Linux installs in the past and they
    went like clockwork, this BYTES~! :-))
    Using JDK 1.2.2 from Sun (as recommended and linked to in the BEA docs)
    If I follow the instructions to the "T" (and I have done so more than once)
    I get the following
    Exception in thread "main" java.lang.NoClassDefFoundError:
    weblogic/kernel/AuditableThread
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:474)
    at
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:247)
    at java.net.URLClassLoader.access$1(URLClassLoader.java:215)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:196)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:311)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:474)
    at
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:247)
    at java.net.URLClassLoader.access$1(URLClassLoader.java:215)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:196)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:311)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at weblogic.Server.startServerDynamically(Server.java:77)
    at weblogic.Server.main(Server.java:65)
    at weblogic.Server.main(Server.java:55)
    <[email protected]> wrote in message
    news:[email protected]...
    I am wrestling with the same problem you are... i get the sameexception
    you mentioned in your first post etc. I agree with you the documentationis
    vexing. I am able to startup the server fine if I dont try to use port80.
    >
    Have you been able to figure out how to use the libs in weblogic/lib/linux
    since you last post? Trying to do the equivalent linux things to setupthese
    libraries has not worked for me. Is there anyone that has setup WL5.1using
    port 80 that would like to share how to setup these libraries?
    andy.
    Ben Ricker wrote:
    I find the documentation, although lengthy, does not adequately seperate
    Unix from Windows NT. For example, there is a linux directory in the
    /weblogic/lib subdirectory. What is this for? How do I use it? Do I need
    to
    use it? There is nothing in the directions that I can see whichreferences
    this directory. I will have a hard time recommending this pproduct forour
    uses if I cannot get a clear understanding of how it works with Linux.
    Has anyone else installed Weblogic server on a Linux machine? How didyou
    set it up?
    Ben Ricker
    US-Rx/Essehealth

  • RMI server fails on a few PCs, works on others

    I have a small RMI server, started on various PC, to which a UNIX server connects to send them messages.
    On each PC I have :
    - An RMI registry.
    - A Java RMI server, ready to receive messages from the UNIX machine.
    All the PC are running Win NT 4 SP6, and the JRE 1.3.1.
    On some PC, when the RMI server receives a RMI call from the UNIX machine, I get this error on the UNIX side :
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
    java.io.InvalidClassException: pop2PcServer_Stub; Local class not compat
    ible: stream classdesc serialVersionUID=2 local class serialVersionUID=385818717
    3882730883
    at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:107)
    at java.rmi.Naming.lookup(Naming.java:60)
    at pop2Pc.main(pop2Pc.java:41)
    It happens every time when these specific PCs are involved.
    I tried everything : the programs don't use a security manager, the PC part starts the registry itself (instead of relying on a separate rmiregistry process). Whatever I do. I can't make the RMI process work correctly on these PC.
    I really don'ty understand, because my program is identical in every case.

    Unfortunately, this is already the case. The classe have been all compiled on the Unix server, and every time they are all bundled in a jar file which is on every PC the same.
    On all the PC I also bundle the JRE 1.3.1 in a subdirectory of my program. With the PATH and CLASSPATH variables I directly point to it, as well as to the jar file.

  • Problem connecting RMI-Server using a servlet

    Hi All..
    I have a RMI-client server model woring fine in AIX box.I am currently in a need to create one web client(may be with servlet or JSP).
    I wrote a sample servlet which try to connect to the RMI server. But when I run the servlet Its simply try to connect and then wait for unlimited time,not even print any exception/error.
    Both my RMI sevrer and Tomcat are in the same box.
    I am sending the servlet code for your reference.
    import java.rmi.*;
    import java.rmi.registry.Registry;
    import java.rmi.registry.LocateRegistry;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import ir77.mon.engine.*;
    public class WebClient extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    XmlServerIntf xmlServerIntf = null;
    PrintWriter out = res.getWriter();
    res.setContentType("text/plain");
    try{
    out.println("Connecting to server......");
    //Seems this one is sufficient.(either this code or the below one)
    //String strServerUrl = "rmi://" + "192.168.100.22" + "/ir77.mon.engine";
    //xmlServerIntf = (XmlServerIntf) Naming.lookup(strServerUrl);
    //Try with this one also
    Registry reg = LocateRegistry.getRegistry("192.168.100.22", 2004);
    xmlServerIntf = (XmlServerIntf) reg.lookup("rmi://192.168.100.22/ir77.mon.engine");
    out.println("Connected to server");
    catch (Exception e){
    System.out.println("Exception in WebClient"+e);
    when I run the servlet in the browser with "http://192.168.100.22:8080/WebClient" its simply prints " Connecting to server......" and waits.
    Note : 192.168.100.22 - where my rmi server starts and 2004 -where I created by rmiregistry.I created it using LocateRegistry.createRegistry(2004);
    I have tried starting tomcat with "-security" option too but no responds as well.
    Do I have to provide some grant permission in catlina.policy file?If yes what?
    currently I have tried with giving all permission..
    Do I need to change the RMI server code?
    Any help will be highly appreciated....

    Hi genady,
    Oh....Ya I like to...I thought no body was interested...as I didn't get any reply from anybody....
    Well The first thing is that with the look up method in the servlet
    it should be like :
    Registry reg = LocateRegistry.getRegistry("ip address of the rmi server", port number);
    RMIServerInterface = (type cast with RMIServerInterface) reg.lookup("rmi binding string");
    Now you are able to get the server interface object & you can call any method.
    Next you have to provide the grant permission in the catalina.policy file to the folder where you have your application like....
    grant codeBase "file:${catalina.home}/webapps/ROOT/WEB-INF/classes/-" {
    permission java.security.AllPermission;
    Or you can give specific permissions also.
    Finally you have to run the tomcat as : $catalina.sh start -security
    Note: One more thing you have to keep in mind that's the structure of your application. ie com.mon.yourapp.......u have to create the same structure in tomcat's classes folder .
    Its done...........

  • Urgent Help Required For Starting RMI server from servlet.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

    I am currently working on rmi project.
    I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
    I am writing servlet and inside it i am binding object to registry for rmi server.
    which will be deployed on remote server.
    code ....
    Registry reg;
    reg=LocateRegistry.createRegistry(1099);
    Server server=new Server("server");//class whose remote object to be accessed
    //extends unicast remote object.Implement ServerInt interface which extends Remote.
    reg.bind("server",server);
    When i am trying to access this object i am getting following exception.
    javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
    on: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: ServerModule.ServerInt]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at RequstReplication.main(RequstReplication.java:27)
    Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
    tion is:
    java.lang.ClassNotFoundException: ServerModule.ServerInt
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    ... 4 more
    Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
    at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    I can access naming enumeration of registry and object bound to it.
    by following program.I shows corect objects.
    Context namingContext=new InitialContext();
    NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
    while(e.hasMore())
    System.out.println(e.next().getName());
    While when i start RMI server from simple java program i can access these objects from registry.
    I am not getting what is problem problem.Is there any other way to send request?
    Plese give quick response.

  • Starting the RMI server on Windows

    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:
    Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
         java.lang.ClassNotFoundException: Hello
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
         java.lang.ClassNotFoundException: HelloI'm suspecting it has 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.

    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. This is correct.
    I'm suspecting it has to do with the codebase parameter that I have omitted.Omitted from what?
    But even if I try to add it I can't seem to figure out a way for it to start.'It' being what?
    The RMI 'codebase' is a list of URLs where classes can be found. You define it in your server JVM via the java.rmi.server.codebase property. Normally the URLs are http: URLs, which means you need an HTTP server which will serve classes or JAR files from the specified URLs.
    Alternatively you can:
    (a) start the client with a classpath that contains the classes mentioned in the remote interface, including itself, and
    (b) (i) start the Registry ditto, or
    (b) (ii) start the Registry inside the server JVM via LocateRegistry.createRegistry.

  • Can't start RMI server using JAR file

    I found it interesting that if I start my RMI server from
    a plain directory, everything goes fine.
    But if I jar all these necessary files into a jar file,
    and start my RMI server with command below
    java -jar server.jar
    UnmarshalException and ClassNotFoundException are
    thrown to indecate that my stub class can't be found
    (which I'm sure my stub class is in jar file)
    Why is jar file so special that it can't act like
    what it originally does when it hasn't been jared?
    or I really should take care of some configuration
    before I really can run a jar file?
    thanks

    To clarify few things...
    What I don't understand is that when I convert all my
    directories and class files properly into the jar file, they
    just can't work properly.
    I don't know if it's a problem of JAR file,
    or it's RMI that make this JAR file special?
    I'll simulate my JAR file structure that listed below,
    these structure works fine when they have'nt been
    converted into JAR file.
    META-INF/
    META-INF/MANIFEST.MF
    a/b/x1.class
    a/b/x2.class
    a/b/c/Y.class
    a/b/c/Y_Skel.class
    a/b/c/Y_Stub.class
    And when I use command "java -jar server.jar"
    to run my application, ClassNotFound exception
    is thrown to indecate my stub class is not found.
    Is there anything I can do to correct this?
    thanks

  • How to Start Java RMI Server Application as Windows NT Service

    Hi!!,
    I have problem regarding the Installation of Java Application as NT Service this Java app in turn will start RMI Registry using LocateRegistry.createRegistry() at some specific port number. The Service is created successfully but i have problem regarding the Accessing of this Remote Object using Lookup() .(ie) I am able to get the RMI Registry Obj Refererce of the Java Rmi Application but couldn't able to Lookup for the Object registered to this Rmi Registry.I am not able to proceed after getting the Rmi Registry reference.
    So any help Regarding this is appreciated.
    Thanks in Advance.
    with regards,
    Ramakrishna M
    Mail: [email protected]

    Hello,
    I have started a Java RMI Server Application as NT Service using JNT (download it from www.eworksmart.com/JNT/ ).
    It is working fine.
    S. Navaneethakrishnan
    [email protected]

  • How to start RMI Server Jar on server?

    Im using RMI, I have two jar files. One Server Jar which contains rmi server, registry start code and all methods which performs action on database .
    I put this jar file on tomcat web-apps directory.
    Another jar is containing User Interface code, which runs on client side.
    for performing any action server jar needs to be run all the time and RMI Registry always needs to be started so that client can communicate with database.
    How can i execute this server jar from client ?

    You can't execute the server from the client. The question doesn't begin to make sense. The server has to be already running for the client to have anything to connect to. You have to organise something at the server side to start it. And putting JAR files into the web apps directory doesn't accomplish that. You could write a Servlet or a listener that starts the RMI server when it's initialised, and stops it when destroyed. If you have to run it inside Tomcat at all, which isn't necessarily a good idea.

  • RMI server doesn't reliably start

    I have a simple RMI server with one object that has one method:
    public interface Foo extends Remote {
          // the Blah class is Serializable
          java.util.ArrayList <Blah> getListOfBlahs (String name);
    public class FooImpl impelments Foo {
        java.util.ArrayLIst <Blah> getListOfBlahs (String name) {
                 // Do whatever...
    }My server is pretty simple at the moment and looks like this:
        public static void main (String [] args) {
            try {
                Foo stub = (Foo)UnicastRemoteObject.exportObject (new FooImpl(), 0);
                Registry registry = LocateRegistry.getRegistry();
                try {
                    registry.unbind ("foo");
                } catch (NotBoundException ex) {
                    System.out.println ("the thing isn't bound at the moment");
                registry.bind ("foo", stub);
                System.out.println ("Server Ready.....");
            } catch (RemoteException rmi) {
                rmi.printStackTrace ();
            } catch (AlreadyBoundException ex) {
                ex.printStackTrace ();
        }The problem is that sometimes when I start it, it promptly dies again with no error messages.
    A couple things:
    1) The server runs on a Fedora Core 8 machine, and the firewall is shutdown.
    2) Before I run the server, I make sure to start the rmiregistry.
    Usually I have to start the server a few times before the process doesn't just die again.
    My hypothesis is that it's trying (unsuccessfully) to bind my Foo class to a port that is in use, but why don't I get an error?
    Are there other log files to look at? Maybe in /var/log somewhere?
    Thanks
    -matthew
    Edited by: matthew on Aug 29, 2008 1:11 PM

    Yep.
    After making some static references to the remote objects, the server starts and stays running:
    class Server {
       private static FooImpl foo;
        public static void main (String [] args) {
            try {
                foo = new FooImpl ();
                Foo stub = (Foo)UnicastRemoteObject.exportObject (foo, 0);
                Registry registry = LocateRegistry.getRegistry();
                try {
                    registry.unbind ("foo");
                } catch (NotBoundException ex) {
                    System.out.println ("the thing isn't bound at the moment");
                registry.bind ("foo", stub);
                System.out.println ("Server Ready.....");
            } catch (RemoteException rmi) {
                rmi.printStackTrace ();
            } catch (AlreadyBoundException ex) {
                ex.printStackTrace ();
    }-matthew

  • Starting and stopping an RMI server

    I'm trying to figure out how to best stop and start my server.
    My server class has two executions. One for starting and one for stopping.
    Start Steps:
    1) create my remote object ( an extension of UnicastRemoteObject )
    2) create a registry ( LocateRegistry.create() )
    3) bind my remote object
    When I run this start method of my RMI server class, everything get's set up. I'm not doing any sort of waiting loop or anything to determine the lifecycle of my server. My understanding is that my rmiregistry, and my registered remote object, will continue to be available indefinitely. Perhaps this is incorrect.
    Stop Steps:
    When I want to stop the server, I'm calling my stop method. This is another invocation of my server class, so it's a separate JVM. In this stop method I want to do the following steps:
    1) get the registry that I created earlier, by port number
    2) get my remote object via reg.lookup()
    3) unbind my remote obect ( reg.unbind() )
    4) unexport my remote object ( UnicastRemoteObject.unexport ( myRemoteObj, true ) )
    My concerns here are whether this makes sense. Does the unexport method work like this? i.e. from a remote handle to the object -- I'm not in the local JVM when the stop method runs. Also, does the rmiregistry "just die" at this point? It's not holding anything and when my method exits there's no reference to it anywhere. Except maybe in client code . . .

    My understanding is that my rmiregistry, and my registered remote object, will continue to be available indefinitely. Perhaps this is incorrect.That's correct as long as you store static references to them both in the server JVM.
    My concerns here are whether this makes sense. Does the unexport method work like this? i.e. from a remote handle to the objectNo. You have to have the actual remote object. You could make shutdown() an RMI method itself.
    Also, does the rmiregistry "just die" at this point?No, you have to unexport that as well.

  • RMI-server works on Windows and Linux but not on Solaris

    I wrote an application which uses RMI. The server is successfully tested on Windows and Linux. However it doesn't work on Solaris.
    Naming.lookup works, I can find the server. But calling a method on my remote interface causes a ConnectionException:
    java.rmi.ConnectException: Connection refused to host: 192.168.1.123; nested exception is:
         java.net.ConnectException: Connection refused: connect
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
         at sun.rmi.server.UnicastRef.newCall(Unknown Source)
         at at.triton.javaengine.server.ServerImpl_Stub.connectToWindow(Unknown Source)
         at at.triton.javaengine.client.JavaEngineClient.connectToWindow(JavaEngineClient.java:288)
         at at.triton.javaengine.client.JavaEngineClient.main(JavaEngineClient.java:787)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
         ... 7 moreNote that I have almost no experience with Solaris.
    Additional information about the common pitfalls which I have already checked:
    * rmiregistry finds the server classes (the exception was different without them)
    * the server is in the LAN and the desktop firewall of the client is double-checked to let the required ports through to any destination.

    java.rmi.ConnectException: Connection refused tohost: >192.168.1.123; nested exception is:
    java.net.ConnectException: Connection refused:
    : connect
    Clearly indicates what is happening inside there.Clearly indicates that you don't know what you are talking about.
    Any applications invoked with a security manager must
    be granted explicit permission to access local system
    resources apart from read access to the directory and
    its subdirectories where the program is invoked.Any application that gets a java.net.ConnectionException: Connection
    refused is getting it more or less directly from the TCP/IP stack. If the problem had anything to do with policies and permissions and SecurityManagers, it would have been an AccessControlException .
    if your client RMI doesnt include these lines then If your 'client RMI' does include these lines then I would like a definition of what exactly a 'client RMI' really is, because I've been using RMI for ten years and wrote a book about it and I certainly don't know.
    1)just include these lines
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new
    SecurityManager());In other words, if the application doesn't already have a security manager, in which case the contents of the policy file or the 'client RMI', or whatever you want to call it, are completely irrelevant, such that they couldn't possibly be having the problem you desrcribe, add a security manager so that we get into the land where you might possibly know what you're talking about?
    e a policy file
    grant {
    permission java.net.SocketPermission
    "192.168.1.123:1099", "accept,connect,resolve";
    };And this is completely unnecessary if there isn't a security manager, and completely unrelated to the OP's problem.

  • Strange unmarshalling exception when starting RMI server

    I've run into a strange problem when running my RMI server. It worked fine yesterday, though I made a few changes since then, none of those changes should cause this to happen, as far as I know.
    Here's the exception:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: pub.interfaces.ClientIface
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:595)
    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:343)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at priv.server.TCMaster.<init>(TCMaster.java:97)
    at priv.server.TCMaster.main(TCMaster.java:71)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: pub.interfaces.ClientIface
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassNotFoundException: pub.interfaces.ClientIface
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
    at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1494)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1457)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
    ... 9 more
    pub.interfaces.ClientIface is in the SAME directory as the RMI server class! What could be causing this?
    NOTE: I'm running this on Redhat Linux 9, jdk 1.5.0_04.

    Usually an unmarshalling exception is caused by the classes not matching up on the server & client end. The classes are there I think, because otherwise it would have thrown a classnotfound exception instead. Can you try actually copying and pasting the classes either from the server to the client or vice versa? I've had weird issues where sometimes the compiler compiles the same class differently in different locations, so your safest bet is to make sure the client & server classes (that you're passing as arguments & returning from the server) are identical.
    Good luck!

  • My RMI Server application Not work under Linux: Exception: Connection reset

    Under Red Hat Linux 8.0 my RMI server application, when I try to bind the Impl class, sends me the exception:
    "java.rmi.UnmarshalException: Error unmarshaling return header;
    nested exception is: java.net.SocketException: Connection reset".
    And it works under Windows 2000 without any problem.
    What could it be?
    Many thanks,
    Ales.

    Hi Ales,
    Try to change your /etc/hosts file, and change the line that says :
    127.0.0.1     MDK localhost.localdomain localhost
    (where MDK is the machine's name).
    Remove MDK from this line and add a new one mapping it to a 'real' outside IP address, visible (check firewall!!!) to the network from where you are approaching the Linux Box
    Good luck,
    Aart

Maybe you are looking for

  • I'm trying to void bits of my data

    I'm working with the Dijkstra algorithm looking at the connection of nodes, well I need to know how to void a line segment, or segments, that are formed by two nodes, however leave the nodes them self intact. How can I do that? My data is given in th

  • Plz.. Help me..... Concurrent program ended with errored.

    hi alll.... I am on working on Oracle Audit trail for mtl_system_item_b (ie. whenever item is changed, created or deleted , i want to track the data, who delete that item and wat item). I followed the below steps to perform that. Steps 1: sysadmin ->

  • Difference in font rendering between 8 and 9

    I've got a PDF that appears differently in Acrobat 8 and Acrobat 9. In Acrobat 8 there are fonts that have remapped to the "undefined" character - boxes instead of letterforms. In Acrobat 9 the file looks correct. "Use local fonts" is turned off in b

  • Please, HELP to convert code from AS2 to AS3!!!

    there is source code from paint application, thank to human who will convert this code, it's codeimportant for us. stop(); var arrSloy:Array = new Array(); //Initial //OnMove _root.onMouseMove = function() {           if (checkPole() && onTool) {    

  • Payment advise on Check

    Hi Friends, My client is currently printing check,payment advise and payment summary separately, they want to change current business process and want to print payment advise on the same page as check. Where do I do that configuration. Moreover, what