调用stop()时,Jcoserver状态更改为STOPPING(不是STOPPED)

时间:2018-12-06 14:09:28

标签: java sap jco sapjco3

我正在使用SAPJco3.jar使用Java连接到SAP。但是,当我试图停止桥梁时,会出现一些错误。

断开连接的代码是这样的:

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!");
}

我得到的错误是:

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

当我尝试停止网桥时,该网桥已经有一些活动连接,并且jcoserver的状态从ALIVE-> STOPPING更改,并且从未进入STOPPED状态。 如果没有连接到服务器的连接,那么它将毫无问题地进入“已停止”状态。

有人可以为这个问题提供任何指导吗? 有什么办法可以我强制停下来?

谢谢!

1 个答案:

答案 0 :(得分:0)

您的自定义SessionReferenceProvider实现似乎有一个错误,即同时在多个线程中返回相同的会话ID。 您是否真的需要自己的SessionReferenceProvider?还是JCo的默认值可能已经足够了?也许您可以在不注册自己的SessionReferenceProvider实例的情况下对其进行测试,看看它是否有效。

如果尚未使用最新的JCo补丁程序级别,我也建议您对其进行更新,以排除JCo中与此相关的已修复错误。 SAP刚刚发布了JCo 3.0.19。参见https://support.sap.com/jco