简体   繁体   中英

Jcoserver status changing to STOPPING (not STOPPED) when stop() is called

I am using SAPJco3.jar for connecting to SAP using Java. However, when I am trying to stop my bridge, I get some error.

The code for disconnection is this :

public void tearDown() {
    log.info("tearDown() | Starting tear down ...");
    log.info("tearDown() | Stopping {} JCO servers ...", jcoServerList.size());

    System.out.printf("\ntearDown()| Stopping %s JCO servers ...", jcoServerList.size());
    System.out.println();

    for (JCoServer jcoServer : jcoServerList.values()) {
        try {

            jcoServer.stop();
            jcoServer.release();

        } catch (Exception e) {
            log.error("Failed to STOP JCO server {} e={}", jcoServer.getProgramID(), e.toString());
        }
    }

    jcoServerDataManager.clearAllData();
    jcoServerDataManager = null;

    log.info("tearDown() | Done with tear down!");
}

The error I get is this :

2018-12-06 15:00:15,504|INFO ||||||SapSessionReferenceProvider| getCurrentSessionReference() | Retrieving current session reference ...
2018-12-06 15:00:15,504|INFO ||||||SapSessionReferenceProvider| getCurrentSessionReference() | Current session reference retrieved Ok (id: sap-session-Default:Test_Bridge_With_External_Test_SAP_JCO:Y3IV_3)
2018-12-06 15:00:15,504|INFO ||||||SapSessionReferenceProvider| getCurrentSessionReference() | Retrieving current session reference ...
2018-12-06 15:00:15,504|INFO ||||||SapSessionReferenceProvider| getCurrentSessionReference() | Current session reference retrieved Ok (id: sap-session-Default:Test_Bridge_With_External_Test_SAP_JCO:Y3IV_3)
2018-12-06 15:00:15,504|ERROR||||||SapConnectionManagerImpl| clearConnectionContext() | Failed to end SAP context: {}
com.sap.conn.jco.JCoException: (132) JCO_ERROR_CONCURRENT_CALL: Concurrent call detected. Connection [13] currently used in another thread: pool-2-thread-1 [100] in execute since 7999 ms. Current thread: 22184429@qtp-6003181-5 [67], action: release.
    at com.sap.conn.jco.rt.ClientConnection.acquireBusyState(ClientConnection.java:185)
    at com.sap.conn.jco.rt.PoolingFactory.releaseClient(PoolingFactory.java:655)
    at com.sap.conn.jco.rt.ConnectionManager.releaseClient(ConnectionManager.java:234)
    at com.sap.conn.jco.rt.Context.endSequence(Context.java:497)
    at com.sap.conn.jco.rt.JCoRuntime.endSequence(JCoRuntime.java:805)
    at com.sap.conn.jco.JCoContext.end(JCoContext.java:97)
    at com.zetes.crystal.sap.io.impl.SapConnectionManagerImpl.clearConnectionContext(SapConnectionManagerImpl.java:258)
    at com.zetes.crystal.sap.io.impl.SapConnectionManagerImpl.closeSapConnection(SapConnectionManagerImpl.java:145)
    at com.zetes.crystal.sap.io.impl.SapConnectionManagerImpl.tearDown(SapConnectionManagerImpl.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:297)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:270)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:162)
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:140)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:462)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:480)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:462)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:430)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:853)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:831)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:794)
    at com.zetes.crystal.setup.server.bridges.impl.BridgeManagementServiceImpl.stopBridge(BridgeManagementServiceImpl.java:614)
    at com.zetes.crystal.setup.server.bridges.impl.BridgeManagementServiceImpl.stopBridge(BridgeManagementServiceImpl.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.gwtwidgets.server.spring.GWTRPCServiceExporter.invokeMethodOnService(GWTRPCServiceExporter.java:148)
    at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:298)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:363)
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:930)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
2018-12-06 15:00:15,504|INFO ||||||SapUserManagementServiceImpl| SAP user <Y3IV_3> has been released
2018-12-06 15:00:15,504|INFO ||||||SapConnectionManagerImpl| tearDown() | Done with SAP connection manager tear down!
2018-12-06 15:00:15,504|INFO ||||||JcoServerConnectionFactory| tearDown() | Starting tear down ...
2018-12-06 15:00:15,504|INFO ||||||JcoServerConnectionFactory| tearDown() | Stopping 1 JCO servers ...
2018-12-06 15:00:15,504|DEBUG||||||JcoServerConnectionFactory|  >> STATUS = ALIVE
2018-12-06 15:00:15,504|DEBUG||||||JcoServerConnectionFactory| >> Stopping JCO Server :: 3IV_ZE9_CLNT_890_001
2018-12-06 15:00:15,504|INFO ||||||JcoServerConnectionFactory| JCO Server ProgID: 3IV_ZE9_CLNT_890_001 [10]       ALIVE ->   STOPPING
2018-12-06 15:00:15,504|INFO ||||||JcoServerConnectionFactory| tearDown() | Done with tear down!
2018-12-06 15:00:15,520|INFO ||||||CockpitServiceImpl| Cockpit harvester of the bridge [Default:Test_Bridge_With_External_Test_SAP_JCO] has been un-registered from Cockpit manager
2018-12-06 15:00:15,520|INFO ||||||BridgeManagementServiceImpl| bridge [Test_Bridge_With_External_Test_SAP_JCO] from site [Default] has been stopped OK
2018-12-06 15:00:15,520|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,520|INFO ||||||BridgeConfigurationPersiterImpl| Configuration for the bridge [Test_Bridge_With_External_Test_SAP_JCO] in site [Default] has been persisted OK
2018-12-06 15:00:15,520|DEBUG||||||BridgeManagementServiceImpl| onApplicationEvent() | begin
2018-12-06 15:00:15,536|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,567|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,567|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,583|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,676|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,676|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,676|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,692|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down
2018-12-06 15:00:15,739|DEBUG||||||SimpleThreadPool| WorkerThread is shutting down

When I am trying to stop the bridge, already there are some connections alive for this bridge and the status of the jcoserver changes from ALIVE -> STOPPING and it never goes to STOPPED. If there are no connections attached to the server, it goes to the status STOPPED without any problem.

Could any one please provide any direction for this problem? Is there any way I can forcefully stop the bridge?

Thanks!

It seems that your custom SessionReferenceProvider implementation has a bug, namely returning the same session ID in multiple threads simultaneously. Do you really need an own SessionReferenceProvider ? Or is the default one from JCo maybe already sufficient? Maybe you can test your scenario without registering your own SessionReferenceProvider instance and see if it works.

And if not already using the latest JCo patch level, I would also recommend to update it in order to exclude already fixed bugs in JCo regarding this. SAP has just released JCo 3.0.19. See https://support.sap.com/jco .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM