我使用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的状态从“活动”->“停止”变为“从不停止”。如果没有连接到服务器,它将进入停止状态,没有任何问题。
有谁能为这个问题提供一些指导吗?有没有办法让我强行拦住那座桥?
谢谢!
1条答案
按热度按时间yhived7q1#
看来你的习惯
SessionReferenceProvider
实现有一个bug,即在多个线程中同时返回相同的会话id。你真的需要自己的吗SessionReferenceProvider
? 或者jco的默认值已经足够了吗?也许你可以测试你的场景而不用注册你自己的SessionReferenceProvider
举例看看是否有效。如果还没有使用最新的jco补丁级别,我也会建议更新它,以排除jco中已经修复的bug。sap刚刚发布了jco 3.0.19。看到了吗https://support.sap.com/jco .