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

Similar Messages

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

  • How to stop the RMI server?

    Hi,
    I create a RMI Server, it has no problem to start. And I created a gui for the server, so that when user press the "start" button, it will start the server.
    But somehow I want to update the server and restart again, but while the server is running, i press the "start" button again, i got the following error messages:
    "Server error: internal error: ObjID already in use"
    Is that mean i have to stop the server first? But how should I stop the server? Thx
    Adrian

    Hi,
    I've tried to unexport the remote object and unbind the registry, but I still got this error message when I try to restart the server on the fly:
    "internal error: ObjID already in use"
    Does anyone know why?
    Thanks.
    Regards,
    Adrian

  • Stop Java RMI server properly

    Hi all,
    Currently, I implemented database application with RMI. But I have a problem about shutting down RMI server properly. Here are my method to start and stop RMI server
        public static void initRMI() {
            try {
                registry = LocateRegistry.createRegistry(Config.PORT);
                driverImp = new RemoteDriverImpl();
                driver = (RemoteDriver) UnicastRemoteObject.exportObject(driverImp, Config.PORT);
                registry.rebind("simpledb", driver);
                System.out.println("putting RMI driver");
            } catch (Exception ex) {
                Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex);
    public static void stop() {
            try {
                System.out.println("Remove rmi entry");
                registry.unbind("simpledb");
                UnicastRemoteObject.unexportObject(driverImp, true);
                System.gc();
            } catch (Exception ex) {
                Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex);
    }When I start server and there is no request from client, the stop() method is working correctly, i.e. the RMI server, as well as, its JVM are terminated.
    But there are some requests from client before, the stop() method only remove stub object from rmiregistry, but doesn't stop its JVM. And I don't want to use System.exit(0) to shut down since the program will continue running other stuffs.
    I hope that I explain the situation clearly.
    Thank you
    Edited by: Apolozeus on Jan 18, 2010 4:05 AM

    Hi all,
    Currently, I implemented database application with RMI. But I have a problem about shutting down RMI server properly. Here are my method to start and stop RMI server
        public static void initRMI() {
            try {
                registry = LocateRegistry.createRegistry(Config.PORT);
                driverImp = new RemoteDriverImpl();
                driver = (RemoteDriver) UnicastRemoteObject.exportObject(driverImp, Config.PORT);
                registry.rebind("simpledb", driver);
                System.out.println("putting RMI driver");
            } catch (Exception ex) {
                Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex);
    public static void stop() {
            try {
                System.out.println("Remove rmi entry");
                registry.unbind("simpledb");
                UnicastRemoteObject.unexportObject(driverImp, true);
                System.gc();
            } catch (Exception ex) {
                Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex);
    }When I start server and there is no request from client, the stop() method is working correctly, i.e. the RMI server, as well as, its JVM are terminated.
    But there are some requests from client before, the stop() method only remove stub object from rmiregistry, but doesn't stop its JVM. And I don't want to use System.exit(0) to shut down since the program will continue running other stuffs.
    I hope that I explain the situation clearly.
    Thank you
    Edited by: Apolozeus on Jan 18, 2010 4:05 AM

  • Java.rmi.server.ExportException: while stopping weblogic Managed server

    Hello,
    I am getting the below error while I try to stop the weblogic managed server from the stop script in the server. I am able to do it thru the console.
    the weblogic version is 9.23.
    -server -Xms1536m -Xmx1536m
    Stopping Weblogic Server...
    Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9990; nested exception is:
         java.net.BindException: Address already in use
    I am a newbie , so anyone could help me figure out the things I need to check so that I can troubleshoot the issue?
    thanks in advance.

    Are you using a custom script or <domain>/bin/stopManagedWebLogic.sh ?
    The msg you've informed seems to be an error that happens when you try to start a managed server that is trying to use a port that is already in use.

  • Rmi server problem

    hi
    Can anybody tell me how to stop the Jvm to free the Rmi server port and the remote object?

    Hi,
    The first step: unbind the bound object from the registry!
    As far as I know the UnicastRemoteObject calls the exportObject() method in its constructor. If you want to force the unregistering call the UnicastRemoteObject's unexportObject() method on the server object.
    After these two calls (Naming.unbind(), UnicastRemoteObject.unexportObject()) the server object surely is no longer listening the remote calls, the JVM exits smothly...
    Sany

  • How to Convert an RMI Server into WINNT service

    I have an RMI Server, that looks like the following
    SimpleRMIServer.java
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.registry.*;
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class SimpleRMIServer
    public static void main(String[] argv) {
    System.setSecurityManager(new RMISecurityManager());
    try {
    LocateRegistry.createRegistry(1099);
    SimpleRMIImpl implementation = new SimpleRMIImpl("SimpleRMIImpl instance");
    // SimpleRMIImpl implementation = new SimpleRMIImpl("SimpleRMIImpl instance");
    System.out.println("SimpleRMIImpl ready");
    catch (Exception e) {
    System.out.println("Exception occurred: " + e);
    the SimpleRMIImpl.java also is available. (SimpleRMIImpl.class)
    now the problem is how to convert this Server to a service.
    I have seen a java class that extends a service class have been converted to a service like the following
    TestService.java
    // TestService.java
    // (C) Copyright 1995 - 1999 Microsoft Corporation. All rights reserved.
    import java.io.*;
    import com.ms.service.*;
    public
    class TestService extends Service
    static
    // Uncomment to disable the assassin. The service will fail to respond
    // in the time specified in the last waithint for the third pause
    // event received. If the assassin is enabled (i.e. this line is commented
    // out, the default), then the service will be forcibly killed.
    //Service.disableassassin = true;
    int pausecount;
    int intcount;
    public TestService (String[] args) throws IOException
    System.out.println("Sending updated pending status");
    CheckPoint(1000);
    System.out.println("Sending running status with all controls");
    setRunning(ACCEPT_SHUTDOWN | ACCEPT_PAUSE_CONTINUE | ACCEPT_STOP);
    System.out.println("Started");
    protected
    boolean handleStop ()
    setStopping(5000);
    System.out.println("dying");
    return true;
    protected
    boolean handlePause ()
    pausecount++;
    if (pausecount == 3)
    System.out.println("pause #3, sleeping for 30 seconds, should be killed in 2+5 seconds");
    setPausing(2000);
    try
    Thread.sleep(30000);
    catch (InterruptedException e)
    System.out.println("interrupted");
    else
    System.out.println("received pause #"+pausecount+", pausing for 2 seconds");
    setPausing(5000);
    try
    Thread.sleep(2000);
    catch (InterruptedException e)
    System.out.println("interrupted");
    System.out.println("sending paused");
    setPaused();
    System.out.println("sent paused");
    return false;
    protected
    boolean handleContinue ()
    System.out.println("received continue, continuing after 2 seconds");
    setContinuing(5000);
    try
    Thread.sleep(2000);
    catch (InterruptedException e)
    System.out.println("interrupted");
    System.out.println("sending running");
    setRunning();
    System.out.println("sent running after continue");
    return false;
    protected
    boolean handleShutdown ()
    System.out.println("received shutdown, treating as stop");
    return handleStop();
    protected
    boolean handleInterrogate ()
    System.out.println("received interrogate");
    setServiceStatus(getServiceStatus());
    System.out.println("sent status for interrogate");
    intcount++;
    if (intcount == 3)
    System.out.println("received 3rd interrogate, stopping self in 5 seconds");
    try
    Thread.sleep(5000);
    catch (InterruptedException iex)
    System.out.println("interrupted");
    System.out.println("stopping");
    StopServiceEventHandler(1000);
    return false;
    using the jntsvc.exe tool, that code have been converted to an executable, then installed as a service.
    I've tried to embed the RMIServer code in the constructor for this service, but it didn't work
    Hope you have a clear understanding of what I'm saying
    any help, highly appreciated
    thanx in advance
    here is my email [email protected]
    regards

    Our second installment of "Questions from the Past"
    Dear viewer, check out Tomcat's source, I believe they implement Tomcat as a service so just follow what they did.
    Steve - your answer Guru
    Tune in next week for our third installment of "Questions from the past"

  • 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 and RMI Client Problem

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
    Anyone know what am I doing wrong?

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it
    works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time
    but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host:
    xxx.xxx.xxx.xxx; nested exception is:
    java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
    I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
    it works again. But I have to keep doing that. I have
    to keep copying the class file to the servlet
    directory every 2nd time I try to run it for it to
    work.
    Anyone know what am I doing wrong?

  • RMI server causes the system to slow down and crash with socketException

    Hi,
    My RMI server application is a simple rmi server which invokes a JNI method once when I invoke through my client application. Server is left as it is after invoking the JNI method. After around 12 hours, server stops running with the following exception
    ZoneInfo: C:\Program Files\Java\jre1.6.0\lib\zi\ZoneInfoMappi
    ngs (Insufficient system resources exist to complete the requested service)
    ZoneInfo: C:\Program Files\Java\jre1.6.0\lib\zi\ZoneInfoMappings (Insufficient s
    ystem resources exist to complete the requested service)
    Dec 29, 2008 10:09:34 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:10:35 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:12:36 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:15:37 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Dec 29, 2008 10:20:40 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAc
    ceptLoop
    WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,por
    t=0,localport=2161] throws
    java.net.SocketException: socket closed
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unkno
    wn Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (4D555445583F57494E13120E4350500075), pid=1352, tid=1828
    # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
    # Can not save log file, dump to screen..
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (4D555445583F57494E13120E4350500075), pid=1352, tid=1828
    # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    Does anyone has any idea?
    Regards
    Nidhin

    Your RMI server invokes a JNI method as you mentioned. It seems your system resource is become very low as from the exception from "ZoneInfoMappi"
    (Insufficient system resources exist to complete the requested service...I would suggest the following
    1- remove the JNI method invocation and replace by a simple method which does nothing special ( counting etc..)
    2- Run the RMI sever and stress test it again
    If you see the RMI server is working well after 12 hours, then your native method is leaking i.e consuming the system resources ( RAM etc..)
    You should profile the running RMI server using jconsole
    Regards,
    Alan Mehio

  • Registry on RMI Server problem

    I have a rmi server app. running 24/7 on a Win2K box with clients connecting locally and over the Internet. Every so often the clients cannot connect and/or currently connected clients cannot communicate with the server. Sometimes we go a month without this happening and sometimes it happens twice in a day. When it does happen, the server app. is still fully functionally. It appears that the registry is locked or corrupt. Clients attempting to connect suceed with the Naming.lookup, but fail after that. When this happens I stop and restart the server app. and the clients can then automatically reconnect. I see other people have had this problem but I haven't seen any solution.
    Thanks.

    Seems as if a bug.
    For more details refer to
    http://developer.java.sun.com/developer/technicalArticles/RMI/rmi/

  • Problem with lost of the access to the RMI server

    Hi to all.
    We have two applications. First one (master) provides to second (slave) through RMI service their data or other resources.
    In the ordinary way all works fine. But if we need for some reason restart master application, slave can't access to the RMI service and calling of the method Naming.lookup(...) throws java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException
    Interestingly, calling of method Namig.list(...) at this moment correctly returns an array of the names bound in the registry.
    For completeness, in the time of restarting master application, classes of the RMI services are not changed and thus Stub/Skeleton classes are same on both sides.
    What is reason for this behaviour? It is way to restart/restore RMI access of the slave application to the master without restarting server (Tomcat) of both applications?
    Thank, Roman

    Thank for your reply, but your suggestion not helped me now.
    For registering and binding I used usual practices. Following snippets of code are inside method that perform initialization on application startup. I was trying three versions.
    First version creates registry and binds service classes only. Without any checks.
    try {
      LocateRegistry.createRegistry(rmiPort);
      String ip = Functions.getCurrentEnvironmentNetworkIp();
      if (ip.startsWith("?"))
        throw new Exception("Can't retrieve application IP address.");
      logger.info("Application IP address: " + ip);+
      RMIServiceCommonImpl rmiServiceCommon = new RMIServiceCommonImpl();
      String name = "rmi://" + ip + ":" + rmiPort + "/";
      Naming.rebind(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME, rmiServiceCommon);
    catch (Exception e) {
      logger.error("Failed to register RMI services: ", e);
    }On first application start all is OK and client has no problem to access RMI service.
    But if master application is restarted, calling of the method LocateRegistry.createRegistry(rmiPort); throws
    java.rmi.server.ExportException: internal error: ObjID already in use
    Since that, client can't access to the RMI service and following code (method Naming.lookup) throws
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException
      String name = "rmi://" + ConfigServlet.getProperty("rmiHostUrl") + "/";
      IRMIServiceCommon service = (IRMIServiceCommon) Naming.lookup(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME);Second version checks if registry exist and trying to get list of registered services. If services not exist Register is created.
    try {
      Registry reg = LocateRegistry.getRegistry(rmiPort);
      String[] list = null;
      try {
        list = reg.list();
      catch (Exception ex) {
        // ignore
      if (list == null || list.length == 0)
        LocateRegistry.createRegistry(rmiPort);
      String ip = Functions.getCurrentEnvironmentNetworkIp();
      if (ip.startsWith("?"))
        throw new Exception("Can't retrieve application IP address.");
      logger.info("Application IP address: " + ip);
      String name = "rmi://" + ip + ":" + rmiPort + "/";
      RMIServiceCommonImpl rmiServiceCommon = new RMIServiceCommonImpl();
      Naming.rebind(name + IRMIServiceCommon.RMI_SERVICE_COMMON_NAME, rmiServiceCommon);
    catch (Exception e) {
      logger.error("Failed to registering RMI services: ", e);
    }Again, first start is OK.
    In this case, after application restart, calling of method Naming.rebind() throws
    java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1272)
    INFO: Illegal access: this web application instance has been stopped already. Could not load eu.arachne.rmi.RMIServiceCommonImpl_Stub.
    This exception is followed by similar exceptions, but differs in class names (stubs) - java.rmi.server.RemoteStub, java.rmi.server.RemoteObject, java.rmi.dgc.Lease, java.rmi.dgc.VMID, java.rmi.server.UID
    Of course, client application can't access to the service.
    The third version first unbinds all services and then performs binding again.
    if (list == null || list.length == 0)
      LocateRegistry.createRegistry(rmiPort);
    else {
      for (int ii = 0; ii < list.length; ii++)
        Naming.unbind(name + list[ii]);
    }But again, rebinding fail as I mentioning above.
    I don't know... :-( How I can solve this problem?
    Thank, Roman

  • XDK 9i Issues : setXSLT - NullPointerException And RMI Server hangs

    Present Scenario :
    JDK 1.3
    Oracle DB : 8.1.6
    JDBC Driver : OracleThin.jar
    XML Parser : xmlparserv2.jar : ( size = 1121488 )
    XML-SQL utility : xsu12.jar : ( size = 180522 )
    We use RMI with JDBC. RMI server object connects to database , uses xsu12.jar and xmlparserv2.jar to convert data into XML. Servlet connects to RMI server and gets this XML. Everything works fine.
    Problem Scenario :
    Since this parser does not support JAXP , I downloaded XDK 9i from oracle site.(9.2.0.1.0 - Dated 01/31/02 ) . After extracting , I replaced xmlparserv2.jar and xsu12.jar with this new ones. And problem started. There are 2 problems :
    A. setXSLT( String, String ) throws NullPointerExcpetion
    B. When I commented setXSLT method, RMI server completes execution of remote method which can be verified from Log. But it never returns , so client gets blocked. When RMI server is stopped by doing ctrl-C , client gets correct XML document.
    Then I installed latest JDBC2.0 driver for 8.1.6 from site which is classes.zip. This also resulted in to same problems mentioned above. But it did work fine wirh earlier version of xmlparserv2.jar and xsu12.jar. Just FYI : I noticed significant size difference betwenn new and old jars.
    New xmlparserv2.jar : size = 660421
    New xsu12.jar : size = 473249
    Thanks for patience
    What could be possible solution ?

    Thanks Jinu
    Problem A of setXSLT throwing NullPOinter Exception is solved. However problem B of RMI server not returning still there.
    Just as an FYI , following is system
    DB : oracle 8.1.6
    xmlparserv2.jar : 9i xdk
    xsu12_816.jar : 9i xdk
    classes12.zip : JDBC2.0 for 8.1.6
    When RMI server is stopped ( ctrl- C ) , client gets correct XML document alongwith proper Node names as set in setStyleSheet( String, String).

  • Detect & re-register in Rmi Server

    Hi,
    I am running rmi registry in separate console. My application is registering an URL in RMI server. Now I am stopping rmi registry & restarting it again.
    Now rmi registry is a new process & all previous registration entries are gone. So my application has to re-register.
    How my application can detect that rmi server is stopped & restarted so that I can re-register it again?
    Any help?
    Here is my code where I am registering
    public void initializeExternalManagementInterface(String serviceURL)
    mbeanServer = MBeanServerFactory.createMBeanServer();
    String domain = m_mbeanServer.getDefaultDomain();
    String mbeanObjectNameStr = domain + ":type=" + EXTERNAL_MBEAN_CLASS_NAME + ",index=1";
    objectName = ObjectName.getInstance(mbeanObjectNameStr);
    Attribute serviceURLAttribute = new Attribute("ServiceURL", serviceURL);
    m_mbeanServer.setAttribute(m_mbeanObjectName, serviceURLAttribute);
    public void startManagementInterface(String jmxServiceURL, String mbeanClassName)
    env.put(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE,"true");
    JMXServiceURL p_jmxServiceURL = new JMXServiceURL(jmxServiceURL);
    LoggerManager.getLogger().info("Starting JMX Server: " + p_jmxServiceURL);
    m_mbeanServerConnector = JMXConnectorServerFactory.newJMXConnectorServer(p_jmxServiceURL, env, m_mbeanServer);
    m_mbeanServerConnector.start();
    LoggerManager.getLogger().info("THE MANAGEMENT INTERFACE STARTED FOR SERVICE URL :" + jmxServiceURL);
    m_jmxConnector = JMXConnectorFactory.connect(p_jmxServiceURL, null);
    m_mbeanConnection = m_jmxConnector.getMBeanServerConnection();
    String domain = m_mbeanConnection.getDefaultDomain();
    m_mbeanObjectName = new ObjectName(domain + ":type=" + mbeanClassName + ",index=1");
    }

    Hi,
    My application has a Watchdog process. It monitors few managed & unmanaged processes. If any process goes down due to some reason then it is responsibility of watchdog to restart it again.
    Rmi registry is one of the unmanaged process for watchdog. So if Rmi stops or killed due to some reason then Watchdog restarts it successfully but the problem is my application has to re register again.
    I want to know how my application can find out that Rmi registry is restarted so lets register again.
    Note: Watchdog process has no way to communicate my application that rmi is restarted so my application has to care it self.
    Suggest me if you have any solution.
    Thanks & regards,
    Jack

  • Kill rmi server, but Naming.list still works

    Hi,
    i have built an rmi server program, which creates some remote objects and a program which lists them. However, the program still lists the objects after the server has shudown. Only as soon as i kill the rmiregistry, the listing stops. Why?
    import java.rmi.*;
    import java.rmi.server.*;
       This server program instantiates two remote objects,
       registers them with the naming service, and waits for
       clients to invoke methods on the remote objects.
    public class ProductServer2
       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("toaster2", p1);
             Naming.rebind("microwave2", p2);
             System.out.println
                ("Waiting for invocations from clients...");
          catch(Exception e)
             e.printStackTrace();
    }The following program lists the remote objects:
    import java.rmi.*;
    import java.rmi.server.*;
    public class ShowBindings
         public static void main(String[] args)
              try
                   String[] bindings= Naming.list("");
                   for (int i=0; i<bindings.length; i++)
                        System.out.println(bindings);               
              catch(Exception e)
                   e.printStackTrace();

    The RMI Registry holds references to remote objects. Your "list" goes against the Registry, not the remote objects.
    The Registry doesn't care what remote objects are alive or dead. That's not it's purpose.
    Use unbind() to remove references in the Registry before ending your server.

Maybe you are looking for

  • Want to backup Oracle 10g on Linux OS faster

    I am looking for fastest way of taking full backup of database oracle 10 g on Linux. To summarize the requirement let me explain what activity we do Whenever we have to apply changes in our application where database changes (create or modify table s

  • VSS errors 8193, 22, and 12292

    We have a Windows 2012 standard server, and once we renamed the server, we started getting the following VSS errors - 8193, 22, and 12292.  How can I fix this?  The errors are listed below.  Thanks in advance! Error 8193 - Volume Shadow Copy Service

  • JSP Page for Checkin services

    Hi, Any one can help in creating a JSP page which can check the Oracle Application Service (opmnctl) running or not. Thanks and Regards

  • Bento won't open after upgrading to Snow Leopard?

    Bento will not open since installing / upgrading to Snow Leopard 10.6 -- just simply tries to start up and quits immediately. Any suggestions other than trashing the existing application and restoring / reinstalling from my original software discs th

  • BDT & EEWB

    I am working on a task to add custom fields to a standard SAP BP tab.  I was going to use EEWB to update BUT000 and create the custom tab in BP, then use BDT to move the fields over to the SAP standard tab.  I have never done this before, so here are