RMI Server terminates himself

I've mad a RMI SSL Server. And it works. But after more or less 1 minute without any Request from a Client the Server terminates himself.
I've tried it with all possibilities (defaultServerFactory, RmiFactory, and with jdk 1.5 new SslRMIServerSocketFactory) and have always the same problem.
The server runs but after 1 one minute it terminates:
RmiServer ready...
RmiServer[UnicastServerRef2 [liveRef: [endpoint:[160.85.179.121:3313,javax.rmi.ssl.SslRMIServerSocketFactory@a0e1ae,javax.rmi.ssl.SslRMIClientSocketFactory@192d342](local),objID:[0]]]]

I've set the properties. But just sun.rmi.transport.logLevel gives an output.
SocketFactorySet
test
sas0
18.10.2004 12:15:20 sun.rmi.transport.StreamRemoteCall <init>
FEINER: main: write remote call header...
18.10.2004 12:15:20 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: main: getting output stream
18.10.2004 12:15:20 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: main: getting input stream
RmiServer ready...
true
--->RMI RUNS
RmiServer[UnicastServerRef2 [liveRef: [endpoint:[160.85.179.121:3939,Reciever.RMISSLServerSocketFactory@1186fab,Reciever.RMISSLClientSocketFactory@1bab50a](local),objID:[0]]]]
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(1)-160.85.179.121: getting input stream
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(1)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(1)-160.85.179.121: getting output stream
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(1)-160.85.179.121: getting input stream
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(1)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(1)-160.85.179.121: getting output stream
Anfrage erhalten
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(2)-160.85.179.121: getting input stream
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(2)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(2)-160.85.179.121: getting output stream
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(2)-160.85.179.121: getting input stream
Anfrage erhalten
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(2)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(2)-160.85.179.121: getting output stream
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(3)-160.85.179.121: getting input stream
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(3)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(3)-160.85.179.121: getting output stream
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(3)-160.85.179.121: getting input stream
Anfrage erhalten
18.10.2004 12:15:36 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(3)-160.85.179.121: call dispatcher
18.10.2004 12:15:36 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(3)-160.85.179.121: getting output stream
---> ....Anfrage erhalten = The Server received request!
then the server terminates... with follow output...
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(4)-160.85.179.121: getting input stream
18.10.2004 12:23:31 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(4)-160.85.179.121: call dispatcher
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(4)-160.85.179.121: getting output stream
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(5)-160.85.179.121: getting input stream
18.10.2004 12:23:31 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(5)-160.85.179.121: call dispatcher
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(5)-160.85.179.121: getting output stream
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getInputStream
FEINER: RMI TCP Connection(6)-160.85.179.121: getting input stream
18.10.2004 12:23:31 sun.rmi.transport.Transport serviceCall
FEINER: RMI TCP Connection(6)-160.85.179.121: call dispatcher
18.10.2004 12:23:31 sun.rmi.transport.StreamRemoteCall getOutputStream
FEINER: RMI TCP Connection(6)-160.85.179.121: getting output stream
----> then i make other requests but no output appears

Similar Messages

  • RMI server exits after 10 minutes

    Hi
    I have a strange problem: The rmi server exits after about 15 minutes when using my own socket factories. The reason seems to be, that only daemon threads are left in the servers VM.
    If I add code like:
    while(true) {
    try {
    Thread.sleep(10000000);
    } catch(Exception e){}
    to the main method, the server continues to run as desired, the main thread is not a daemon thread.
    I checked the accept method of my factory, it runs in a daemon thread.
    Is there any configuration property to specify that the server should run forever?
    BTW: the server does not exit when using no own socket factories.

    No, I don't export manually. However, isn't that the job of the naming service?
    Calling export causes an "Object already exported" exception.
    Here is the complete working main code that starts the server (removing the endless loop will cause the server VM to terminate after about 15 minutes of inactivity):
    public static void main(String args[]) throws Exception
    TClientSocketFactory client = new TClientSocketFactory();
    TServerSocketFactory server = new TServerSocketFactory();
    client.setServiceName("authtest");
    server.setServiceName("authtest");
    AuthImpl obj = new AuthImpl(client, server);
    Naming.rebind(
    "//" + InetAddress.getLocalHost().getHostName() + "/AuthServer",
    obj
    while(true) {
    try {
    Thread.sleep(10000000);
    } catch(Exception e){}
    Cheers...Urs

  • Remote reference to an RMI server

    I was going through some of the posts here and somebody mentioned : -
    "The Registry is a client that
    holds a reference to your remote object. If the remote object
    terminates, the reference remains, (as it would with any other
    client). You must manually purge the reference, (possibly with
    an unbind()).
    This is contrary to what I thought "the remote reference to an RMI server not implementing activatable remains valid as long as the server itself remains running and no longer. Is it a misunderstanding on my part?

    hi Ayesha,
    You are right
    "the remote reference to an RMI server not implementing activatable remains valid as long as the server itself remains running and no longer".

  • Stopping an RMI server

    hi all,
    i was curious about one hting: how can i stop a running RMI server via command line?
    will stop rmiregistry works??
    thanx and regards
    marco

    Hi,
    I have solved this problem by combining two techniques.
    First I save a copy of the current thread (Thread.currentThread() returns it) in a member variable of the class that implements the remote interface. This is done in the main() method that creates the instance of the object and registers it with the RMI service.
    Then I put the thread executing the main() method to sleep by calling Thread.currentThread().join(). It will sleep indefenately until interrupted.
    The other trick is to add a method to the remote interface called stopServer() and to implement it in the class that implements the remote interface.
    The stopServer() method simply calls the interrupt() method on the saved reference to the sleeping thread that executed the main() method until it was put to sleep.
    The result is that the sleeping call to join() in the main() method wakes up by throwing an InterruptedException, which you catch.
    Then you can have the remaining code body of the main() method proceed to unbind the remote object from the running RMI service, shut it down properly, and delete it (setting it equal to null).
    Finally, you must terminate the main() method by a call to System.exit( 0 ). Simply returning is not enough, since the RMI API does not offer any methods() for stopping it. But the exit() will kill the entire VM.
    Therefore it is propably important to really shotdown everything nicely and perhaps even call the garbage collecter to have it clean up explicitly, before killing the VM by the exit() call.
    Note that I also always start the RMI service in the beginning of my main() methods. I think this makes the RMI server application more complete.
    I have done this a lot of times and can e-mail a copy of a package that I always use as a template when beginning new RMI client/server projects. Just mail me at
    [email protected]
    and I'll send it to you. Good luck!
    Sincerely yours...

  • 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.

  • Attempting to use SSL over RMI from a web application to a RMI server

    Hi,
    I am attempting to use SSL over RMI to a server. The client is the web
    application that is hosted on WebLogic and that attempts to connect to the
    server. There is no client or server verification at either the client or
    the server end. The code works outside of WebLogic 7/8 but has the following
    issues when running the web application inside weblogic:
    java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
    exception is:
    java.net.ConnectException: Connection refused: connect
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
    at java.net.Socket.<init>(Socket.java:268)
    at java.net.Socket.<init>(Socket.java:95)
    at
    sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
    actory.java:20)
    at
    sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
    actory.java:115)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:79)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
    ctionClient.java:59)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
    lient.java:197)
    at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1058)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :401)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :445)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :306)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5445)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3105)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2588)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    The code at the client that initiates the connection:
    socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
    socket.setEnabledCipherSuites(CIPHERS);
    socket.setEnableSessionCreation(true);
    Any ideas?
    Thanks

    I don't see anything that indicates SSL was directly a factor in the
    failure.
    From the exception stack it looks like a more basic connectivity issue,
    maybe the URL for the
    RMI server is incorrect for some reason or the server was down.
    It looks like you are doing something like this:
    SSL client -> WLS server with servletA, servletA RMI client
    (com.hyperion.css) -> RMI server
    The connection failure appears to be the connection from servletA RMI client
    to the RMI server.
    Is that a correct picture?
    Tony
    "Gaurav Khanna" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am attempting to use SSL over RMI to a server. The client is the web
    application that is hosted on WebLogic and that attempts to connect to the
    server. There is no client or server verification at either the client or
    the server end. The code works outside of WebLogic 7/8 but has thefollowing
    issues when running the web application inside weblogic:
    java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
    exception is:
    java.net.ConnectException: Connection refused: connect
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
    at java.net.Socket.<init>(Socket.java:268)
    at java.net.Socket.<init>(Socket.java:95)
    at
    sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
    actory.java:20)
    at
    sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
    actory.java:115)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:79)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
    ctionClient.java:59)
    at
    com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
    lient.java:197)
    at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
    at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1058)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :401)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :445)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :306)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5445)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3105)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2588)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    The code at the client that initiates the connection:
    socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
    socket.setEnabledCipherSuites(CIPHERS);
    socket.setEnableSessionCreation(true);
    Any ideas?
    Thanks

  • Error while registering RMI Server

    Hi
    I have a system connected to bradband with a static ip. I am planning to use this as the RMI server and any system connected to the internet as the client. Is this possible....?
    I tried to bind the name to the registry and I get the following error.
    C:\PROGRA~1\Java\jre1.5.0_06\bin>java -Djava.security.policy=policy HelloServer
    HelloServer error: Connection refused to host: 59.144.28.215; nested exception i
    s:
            java.net.ConnectException: Connection refused: connect
    java.rmi.ConnectException: Connection refused to host: 59.144.58.215; nested exc
    eption 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 sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
            at java.rmi.Naming.rebind(Unknown Source)
            at HelloServer.main(HelloServer.java:18)
    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 S
    ource)
            at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
    ource)
            ... 7 moreCan anyone help me by resolving this error.....

    what do you mean by intranet address?
    If you use some NAT device (e.g, DSL, cable) that it is likely you won't be able to access the registry using the external IP address. In such case you need to open the registry port in the firewall.

  • Not able to run a simple RMI server

    I am running an RMI program like follwing
    import java.rmi.* ;
    import java.rmi.registry.* ;
    import java.rmi.server.* ;
    public class CallBeanServer extends UnicastRemoteObject implements ICallBeanServer
         //main
         public static void main(String args[]) throws Exception
              int port = 1000 ;
              Registry reg = null ;
              if( args[0].equals("true"))
                   reg = LocateRegistry.createRegistry(port) ;
                   System.out.println("Successfully created registry") ;
              else
                   reg = LocateRegistry.getRegistry(port) ;
                   System.out.println("Connected to existing registry") ;
              CallBeanServer callBeanServer = new CallBeanServer(reg) ;
         }//main
         //constructor
         public CallBeanServer(Registry reg) throws Exception, RemoteException
              super() ;
              reg.rebind("CallBeanServer",this) ;
              System.out.println("CallBeanServer Object bound") ;
         //my public method
         public String callBeanServer() throws RemoteException
         {          return "Success" ;
    I have run the rmiregistry at port no 1000 like
    rmiregistry 1000
    I have compiled ICallBeanServer also and run rmic also over CallBeanServer like
    rmic CallBeanServer
    when I run this program using
    java CallBeanServer false
    it gives the follwoing errors
    Connected to existing registry
    Exception in thread "main" java.rmi.ServerException: Server RemoteException; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    java.lang.ClassNotFoundException: CallBeanServer_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at CallBeanServer.<init>(CallBeanServer.java:38)
    at CallBeanServer.main(CallBeanServer.java:30)
    Can you please tell me what is the error?
    Thanks
    Prashant Gupta

    Add the classes (the stubs included) to the classpath when you start the registry.

  • Crazy Exception blocked my RMI server

    Hi all one crazy exception is thrown when I try to start the server. Plz reply me the the possible cause and solution.
    thanks in advance
    The exception is :
    Error starting service
    java.rmi.server.ExportException: Listen failed on port: 0; nested exception is:
    java.net.SocketException: JVM_Bind (code=10055)

    You cant listen / bind on port 0. Try a different port number greater than 1024. That should work out.

  • Load balancing on RMI Server Application

    Hi there, I'd like to know more detail about load balancing on RMI server application, been digging the web for some time, but couldn't find much information, does anyone know any website or has the knowledge of load balancing on RMI to share? Sort like its design and implementation.
    Thanks,
    Jax

    I want performance and fault-tolerance,
    In that case, is it necessary to have a main
    rmi server to allow client to access and pick one of
    the rmi servers for the client?Well, if you have one main RMI server, you have a single point of failure again.. Why can't your application know about all rmi servers, and randomly choose one? If it's down, pick a different one.. If your applicatoin is an applet, you'll have to sign it.. Do that and put it on 2 redundant web servers. You have performance by splitting the load and you have your fault tolerance by having x identical rmi servers.
    If you're saying what I think, why would you have one main rmi server that picks a different rmi server? That's more work AND your redundancy goes byebye, ie if your main rmi server dies..

  • How to get the IP address of RMI server???

    Hi:
    Is there a way to know the IP address of RMI server before client and server connect?
    I am assuming that client didn't know the IP address of the server.
    Because I know that client must hold a server reference so that client can connect to server.
    But I want my client program to find out server IP address before they connect and use this finding to connect to server.
    Is it possible?
    Thanks!

    So you KNOW that the client MUST know where the server is yet you want the client to find out where the server is?
    Simple answer: forget it.
    If you don't know where to connect to how are you ever going to connect to it?
    And if you do know you don't have to go looking it up...
    You can probably do something with JNDI, but then you're only putting off the inevitable as now you need to both know how to contact the JNDI server AND the JNDI server needs to know where the the RMI registry for the service you want to connect to is.

  • How do I make a RMI client running in Bea find a remote, non Bea, RMI server?

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

    On my stand alone test system I run a RMI server in one JVM,
    registry.exe and a RMI client in its own JVM. The client uses
    java.rmi.Naming.lookup() to find the RMI server, and this works fine.
    If I run the same RMI client class within Bea the naming lookup fails! I
    guess this is due to Bea using it own RMI registry rather than the
    registry.exe I started separately(?)
    QUESTION: How do I make a RMI client running in Bea find a remote,
    non-Bea, RMI server?
    Of course, in the final environment the server will run on a system
    remote from Bea.
    The RMI client calls are done from a servlet, not from a EJB.
    The doumentation about using RMI with Bea is focused on running the RMI
    server within Bea. This might be the "normal" thing to do, but in our
    case Bea is the client, not the server. Do I still need to use
    weblogic.rmi.*....? If so, where?
    Grateful for any tip.
    Göran Hagnell

  • Cant create JDBC Connections in RMI Server

    I am having a pretty weird problem which I am struggling with for the last three days. In the main method of the Server object, following three things are supposed to happen:
    1) Creation of a JDBC Connection
    2) Creation of a Remote Object and then publishing the same to Registry.
    3) Creation of another JDBC Connection (exactly same as in step1)
    step 1 and 2 successfully executes and the third one always errors out. I just simply get a NullPointerException.
    If I comment out step 2, step 3 executes successfully. Can someone please tell me the mystery? I need your response really urgently so please help me.
    TIA
    Code Snippet:
     public static void main(String[] args) {
      System.setSecurityManager(new RMISecurityManager());
      try {
       Properties dbProps = new Properties();
       dbProps.put("user", "SDAWOODI");
       dbProps.put("password", "SDAWOODI");
       java.sql.Connection connection =    java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps);
      catch (Exception sqle) {
       System.out.println("[11111]"+sqle.toString());
      Properties props = new Properties();
      props.put("java.rmi.server.codebase", rmiCodeBase);
      System.setProperties(props);
      try {
       SchedulerRImpl schedulerR = new SchedulerRImpl(ssce_sch1);
       String nameStr = "s-sce-scheduler";
       try {
        Naming.bind(nameStr, schedulerR);
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler bound with RMI registry!!!");
       catch (AlreadyBoundException abe) {
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler is already bound with RMI registry ... trying RE-bind ...");
        try {
         Naming.rebind(nameStr, schedulerR);
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler RE-bound with RMI registry!!!");
        catch (Exception e) {
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Rcheduler RE-binding failed :(((");
      catch (Exception e) {
       if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] SchedulerR instantiation failed:((( : "+e.toString());
      Properties dbProps2 = new Properties();
      dbProps2.put("user", "SDAWOODI");
      dbProps2.put("password", "SDAWOODI");
      try {
       java.sql.Connection connection2 = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps2);
       if (connection2==null) {
       System.out.println("connection is NULL");
      else {
       System.out.println("connection is NOT null");
     catch (Exception sqle2) {
      System.out.println("[22222]"+sqle2.toString());
    }

    In reply to reply #4:
    You can also quote the other part of my reply when it comes to snippets. There are so many pieces of code missing from your snippet that I simply cannot guess what is wrong. (Please do not put your entire class structures here.)
    We get connections in many different classes at many different times. It is after all an application that does user work and the user work involves database accesses. Some of those accesses are before RMI (to establish repositories, etc). Most are after.
    This URL (jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV) appears to use a network connection (yes?). Is the 1521 a port? Are you trying to reuse this port? (the first conn uses the same URL). What port does RMI use?
    There is nothing in your snippet that stands out obviously as "this is wrong".
    RMI uses networking. JDBC uses networking.
    Try substituting some other networking code in place of the RMI code and see if you still get a null trying the second connection. As you say, if you leave out the RMI code the second get.conn works.
    Try leaving out the first get.conn. Do the RMI and second get.conn.
    Try this and try that and try some more. I once had this problem with a network printer that would not print. The code was fine. The URL was fine. The response from the network and printer were both fine. The damn thing just wasn't printing. Turns out there was this bit, yes a single bit, in one word of a property called the "start print bit". If this bit wasn't on, nothing happened. I tried every combination until I finally found it.
    I wish you the best.

  • RMI Server Offline Problem

    Hello all, I am e newbie in the world of RMI programming. I have developed an application that can control two devices over the internet. The code files are given below :
    Parallel.java
    import java.rmi.*;
    public interface Parallel extends Remote
         void relayDriver(byte k) throws RemoteException;
         byte currentStatus() throws RemoteException;
    ParallelImpl.java
    import parport.ParallelPort;
    import java.rmi.*;
    import java.rmi.server.*;
    public class ParallelImpl extends UnicastRemoteObject implements Parallel
         private Byte ctrlValue;
         ParallelPort lpt1 = new ParallelPort(0x378); // 0x378 is normally the base address for the LPT1 port
         public ParallelImpl(byte a) throws RemoteException
              ctrlValue = a;
              lpt1.write(ctrlValue);
              System.out.println("Device Actuation Code "+ctrlValue);
         public void relayDriver(byte k) throws RemoteException
              ctrlValue = k;
              System.out.println("Device Actuation Code "+ctrlValue);
              lpt1.write(ctrlValue);
         public byte currentStatus() throws RemoteException
    return ctrlValue;
    ParallelClient.Java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ParallelClient extends JApplet implements ActionListener
         Byte g;
         String url = "rmi://169.254.196.149/";
         private Container container;
         private javax.swing.JTextArea resultArea;
         public void init()
              container = getContentPane();
              container.setLayout( new BorderLayout() );
              resultArea = new javax.swing.JTextArea();
              JRadioButton buttonZero = new JRadioButton("No Device
    On");
         buttonZero.setMnemonic(KeyEvent.VK_A);
         buttonZero.setActionCommand("0");
         buttonZero.setSelected(true);
         JRadioButton buttonOne = new JRadioButton("Device 1 On
    Only");
         buttonOne.setMnemonic(KeyEvent.VK_B);
         buttonOne.setActionCommand("1");
         JRadioButton buttonTwo = new JRadioButton("Device 2 On
    Only");
         buttonTwo.setMnemonic(KeyEvent.VK_C);
         buttonTwo.setActionCommand("2");
         JRadioButton buttonThree = new JRadioButton("Device 1
    and 2 Both On");
         buttonThree.setMnemonic(KeyEvent.VK_D);
         buttonThree.setActionCommand("3");
         //Group the radio buttons.
         ButtonGroup group = new ButtonGroup();
         group.add(buttonZero);
         group.add(buttonOne);
         group.add(buttonTwo);
         group.add(buttonThree);
         //Register a listener for the radio buttons.
         buttonZero.addActionListener(this);
         buttonOne.addActionListener(this);
         buttonTwo.addActionListener(this);
         buttonThree.addActionListener(this);
              JPanel radioPanel = new JPanel(new GridLayout(0, 1));
         radioPanel.add(buttonZero);
         radioPanel.add(buttonOne);
         radioPanel.add(buttonTwo);
         radioPanel.add(buttonThree);
         container.add(radioPanel, BorderLayout.LINE_START);
              container.add(resultArea, BorderLayout.SOUTH);
         public void actionPerformed(ActionEvent e)
              try
                   Parallel r1 = (Parallel)Naming.lookup(url +
    "inival");
                   if(r1.currentStatus()==0)
                             resultArea.setText("Previous
    Status: No Devices Online....");
                        else if(r1.currentStatus()==1)
                             resultArea.setText("Previous
    Status: Device 1 Online. Device 2 Offline.");
                        else if(r1.currentStatus()==2)
                             resultArea.setText("Previous
    Status: Device 2 Online. Device 1 Offline.");
                        else
                             resultArea.setText("Previous
    Status: Device 1 & 2 both are Online.");
                   g = Byte.parseByte(e.getActionCommand());
                   r1.relayDriver(g);
                   if(r1.currentStatus()==0)
                             resultArea.setText("Current
    Status: No Devices Online....");
                        else if(r1.currentStatus()==1)
                             resultArea.setText("Current
    Status: Device 1 Online. Device 2 Offline.");
                        else if(r1.currentStatus()==2)
                             resultArea.setText("Current
    Status: Device 2 Online. Device 1 Offline.");
                        else
                             resultArea.setText("Current
    Status: Device 1 & 2 both are Online.");
              catch(Exception et)
                   resultArea.setText("Server OffLine");
    ParallelServer.java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    public class ParallelServer
         public static void main(String args[])
              try
                   System.out.println("Constructing Server Implementations ....");
                   ParallelImpl p1 = new ParallelImpl((byte)0);
                   System.out.println("Binding Server Implementation to registry ....");
                   Naming.rebind("inival",p1);
                   System.out.println("Waiting for invocations from Client ....");     
              catch(Exception e)
                   System.out.println("Server is Offline or Line has broken. Error : "+ e);
    The corresponding stub files, class files have been loaded on the internet. http://rcviproject.110mb.com/
    On the server machine the rmi registry is on and the ParallelServer program is also running. But when the applet at the URL is actuated then it shows 'server offline'. Why is this happening? Please help.

    That did not print anything. The server when started by the following commands :
    start rmiregistry
    start java ParallelServer
    continues to run at Waiting for invocation from client ...... no error msg is shown.
    do i need tomcat on the server machine in addition to this ?

  • RMI server object lookup in a session bean

    Hi all,
    I am getting MarshalException when I call java.rmi.Naming.lookup() in a session
    bean. Following is the code and exception. Please note that I am using java.rmi
    package instead of weblogic.rmi and that both the session bean and RMI server
    object (a startup class) is deployed on the same machine.
    Thanks for your help in advance.
    // a simple, replica-aware session bean method
    // some code here
    try {
    MediatorInterface mediator = (MediatorInterface) java.rmi.Naming.lookup("rmi://localhost:7001/TestMediator);
    catch (Exception e) {
    // log the exception
    The exception:
    java.rmi.MarshalException: Error marshaling transport header; nested exception
    i
    s:
    java.io.EOFException
    java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:224)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:206
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:84)
    at test.mgmtop.CreateNetworkOpHandler.execute(CreateNetworkOpHandler.jav
    a:88)
    at test.mgmtop.CreateNetworkOpHandler.perform(CreateNetworkOpHandler.jav
    a:28)
    at test.ejb.MgmtServiceBean.create(MgmtServiceBean.java:57)
    at test.ejb.MgmtServiceSession_idi8yo_EOImpl.create(MgmtServiceSession_i
    di8yo_EOImpl.java:46)
    at test.ejb.MgmtServiceSession_idi8yo_EOImpl_WLSkel.invoke(Unknown Sourc
    e)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
    ef.java:114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:762)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
    a:295)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
    .java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)

    Hi Pyung,
    How about trying this instead:
    InitialContext ctx = new InitialContext();
    MediatorInterface mediator = (MediatorInterface) ctx.lookup("TestMediator");
    This assumes your startup class binds the Mediator to the JNDI name "TestMediator".
    - Matt
    Pyung Yoon wrote:
    Hi all,
    I am getting MarshalException when I call java.rmi.Naming.lookup() in a session
    bean. Following is the code and exception. Please note that I am using java.rmi
    package instead of weblogic.rmi and that both the session bean and RMI server
    object (a startup class) is deployed on the same machine.
    Thanks for your help in advance.
    // a simple, replica-aware session bean method
    // some code here
    try {
    MediatorInterface mediator = (MediatorInterface) java.rmi.Naming.lookup("rmi://localhost:7001/TestMediator);
    catch (Exception e) {
    // log the exception
    The exception:
    java.rmi.MarshalException: Error marshaling transport header; nested exception
    i
    s:
    java.io.EOFException
    java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:224)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:206
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:84)
    at test.mgmtop.CreateNetworkOpHandler.execute(CreateNetworkOpHandler.jav
    a:88)
    at test.mgmtop.CreateNetworkOpHandler.perform(CreateNetworkOpHandler.jav
    a:28)
    at test.ejb.MgmtServiceBean.create(MgmtServiceBean.java:57)
    at test.ejb.MgmtServiceSession_idi8yo_EOImpl.create(MgmtServiceSession_i
    di8yo_EOImpl.java:46)
    at test.ejb.MgmtServiceSession_idi8yo_EOImpl_WLSkel.invoke(Unknown Sourc
    e)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
    ef.java:114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
    eManager.java:762)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
    a:295)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
    java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)

Maybe you are looking for

  • Blocking p2p or setting up a firewall to only allow certain programs?

    Hello there, I have a wireless dual-n router (WRT610N) and a cable modem (CM100) both from linksys. My problem is that we live in an aprtment with 6 people and sometimes the connection crawls even with 2-3 people using the internet. My concern is tha

  • Read ABAP CDS view data in HANA CDS view

    Hi experts, We have created some ABAP CDS views, which we would like to reuse in a HANA CDS view. When I refer to the ABAP CDS view as "SAP<SYSID>"."Z_ABAP_VIEW_NAME" in the HANA CDS view definition, I get a syntax error: Cannot find artifact... Is i

  • Can't use TCPIP Link Configuration

    I have my GroupWise system running on single NetWare 6.5 SP7 server. I have the link configuration set as UNC but I was told it is better to use TCPIP protocol. However, when I changed the link configuration to TCPIP and said the IP address to 192.16

  • EPS and Flattening

    Hello, I'm a longtime Freehand user trying to come up to speed on Illustrator's flattening feature. Using Illustrator CS2 I've created an EPS file that will be imported into Multi-Ad Creator 'Professional' document for newspaper printing. I've examin

  • Heavy static in recording

    Captivate 3: I am using a high quality Shure mic with a Tube MP Preamp, and external USB Behringer sound card. When I record in Captivate, I have a huge amount of underlying static/white noise sounding material underneath. It's got to be something wi