0

我正在使用 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。

任何人都可以为这个问题提供任何方向吗?有什么办法可以强行停桥吗?

谢谢!

4

1 回答 1

0

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

如果还没有使用最新的 JCo 补丁级别,我还建议对其进行更新,以排除 JCo 中已经修复的错误。SAP 刚刚发布了 JCo 3.0.19。请参阅https://support.sap.com/jco

于 2018-12-22T14:32:28.713 回答