Skip to Content
avatar image
Former Member

Stop and re-start JCo Idoc Server

Hi

I created a JCO IDoc server (using the JCoIDocServer class) , so far it works fine for me to send and receive IDocs to R/3. The only issue is when I try to start and stop the JCO Idoc server at runtime. When I call the Stop method(). It seems like the service is stopped but if i call a Start method after that( even on a completely new class instance) I'm getting a nullpointer exception. I have seen documents on JCOServer says that use suspend method for stop the server, but this is not available for the JCoIDocServer class. How can I stop a server which is running, programaticalluy and restart it again ? (I dont mind if I have to reinstantiate the whole server class) . I use JCO and IDoc libaray version 3.0 . Please help

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Jun 30, 2009 at 02:15 PM

    Did anyone have an answer for this?? When I stop the server and again do a getserver(dest) , and after try a server start(), I'm getting java nullpointer exception. Although the server instance is seems to be right with all the required parameter values . The same start() call works for the first time(if I start the application from commandline) once I stop() it from code and agin do a start from the code it gives me nullpointerexception. All ideas are welcome.

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 30, 2009 at 02:38 PM

    Here is the trace if this helps

    java.lang.NullPointerException

    at java.util.Hashtable.get(Unknown Source)

    at com.sap.conn.jco.rt.DefaultServerManager.addServer(DefaultServerManager.java:130)

    at com.sap.conn.jco.rt.DefaultServer.addListener(DefaultServer.java:251)

    at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:609)

    at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:596)

    at com.sap.conn.idoc.jco.DefaultJCoIDocServer.start(DefaultJCoIDocServer.java:96)

    at com.timelink.erp.connectors.Jco.TLSAPJCoServer.JCoTRfcServer(TLSAPJCoServer.java:526)

    at com.timelink.erp.connectors.Jco.TLSAPJCoServer.run(TLSAPJCoServer.java:88)

    at java.lang.Thread.run(Unknown Source)

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2009 at 01:43 PM

    HI Experts,

    DId I posted this on the right place?? Or do I have to move this to a different forum. Please advice.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2010 at 04:58 PM

    Hello Dear,

    Is it a standalone application?

    I am looking for something like that, Could you guide me how to build such tool or if would like to share?

    Regards,

    Nams

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2010 at 04:58 PM

    Hello Dear,

    Is it a standalone application?

    I am looking for something like that, Could you guide me how to build such tool or if would like to share?

    Regards,

    Nams

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 21, 2010 at 12:14 PM

    Hi,

    Try using the abort() after your stop in a "if" condition. You need to provide a message as a parameter for the abort() method, so that the remote SAP System (in case the IDoc Server is still connected to it) knows the reason why the IDoc server shutdown without any warning.

    So your code should look something like this (warning pseudo-code 😉 ) -

    server.stop();
    if(server.alive())
    {
           server.abort("Forcing shutdown because its wakey wakey eggs and beccy time!");
    }
    

    Try logging the status of the server after the stop() and abort() methods to know what the server is doing. I hate people using the suspend() method to "stop" the server, because it does not stop the server. It only suspends operations, so your connection and session to the remote SAP System remains open.

    After the time out (can be hours) on the remote System, the connection is closed, but until then, the remote SAP System keeps expecting your server to talk back to it. Open sessions are of course more dangerous than runaway trains, so avoid the suspend() method if you can.

    T00th

    Edited by: Sameer Jagirdar on Jan 21, 2010 1:14 PM --> fixed the code display thingy.

    Edited by: Sameer Jagirdar on Jan 21, 2010 1:15 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 04, 2010 at 11:37 AM

    HI I'm having exactly the same problem with JCO 3.01.

    When I stop my rfc server (due to network problems etc), rebuild the connection, it produces almost exactly the same error.

    4.7.2010::13:32:41:937>>SYSTEM: java.lang.NullPointerException

    java.lang.NullPointerException

    4.7.2010::13:32:41:937>> at java.util.Hashtable.get(Hashtable.java:334)

    4.7.2010::13:32:41:937>> at com.sap.conn.jco.rt.DefaultServerManager.addServer(DefaultServerManager.java:130)

    4.7.2010::13:32:41:937>> at com.sap.conn.jco.rt.DefaultServer.addListener(DefaultServer.java:251)

    4.7.2010::13:32:41:937>> at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:609)

    4.7.2010::13:32:41:937>> at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:596)

    Could it be a problem with the Java Connector 3.01?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Markus Tolksdorf

      Hello!

      We are one JCO 3.0.9 and IDOC library 3.0.7.

      Since the first JCO 3.x release we are unable to make the restarting of the server work properly.

      When we get a network problem, we disconnect via:

      server.stop();

      and then wait in a loop until server.getState() is JCoServerState.STOPPED.

      Then we call:

      server.release();

      and (to prevent getting NullPointerException as original poster)

      StandaloneServerFactory.get().deleted(serverName);

      However, when we want to restart the server we first get (9 times in a row with 10seconds between retries - so 90sec total):

      com.sap.conn.jco.JCoRuntimeException: (136) JCO_ERROR_ILLEGAL_STATE: JCo server is currently running. Current server state is DEAD

              at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:744)

              at com.sap.conn.idoc.jco.rt.DefaultJCoIDocServer.start(DefaultJCoIDocServer.java:177)

      And interestingly in next retry we get this:

      com.sap.conn.jco.JCoRuntimeException: (136) JCO_ERROR_ILLEGAL_STATE: JCo server is currently running. Current server state is ALIVE

              at com.sap.conn.jco.rt.DefaultServer.start(DefaultServer.java:744)

              at com.sap.conn.idoc.jco.rt.DefaultJCoIDocServer.start(DefaultJCoIDocServer.java:177)

      And after this, the server can not be started again (everytime we retry calling server.start() we get error above).

      Are we doing something wrong ? What is the correct way to restart the JCO Server (after network problems, etc) ?