cancel
Showing results for 
Search instead for 
Did you mean: 

Stop and re-start JCo Idoc Server

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (7)

Answers (7)

mac24nz
Explorer
0 Kudos

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?

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

JCo 3.0.1 is a very old patch level. You should go to the latest one available, which is currently 3.0.5. In addition to that go to IDocLibrary 3.0.4. If there are still issues with stopping and restarting a closer look at it would be necessary.

Regards,

Markus

Former Member
0 Kudos

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) ?

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

HI Experts,

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

Thanks

Former Member
0 Kudos

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

Former Member
0 Kudos

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