public class TestPtp {
static ORB orb;
static EMSMgr_I emsMgr = null;
static EmsSession_I emsSession = null;
static EmsSession_I emsSession1 = null;
static ManagedElementMgr_I meMgr = null;
static PerformanceManagementMgr_I peMgr = null;
private static DynAnyFactory dynAnyFactory = null;
NmsSession_I csession = null;
EmsSession_IHolder sessionHolder = null;
public void invoke() throws Exception {
// 建立连接登录、建立消息通道
String[] args = new String[2];
args[0] = "-ORBInitRef";
args[1] = "NameService=corbaloc:iiop:192.168.124.1:20266/NameService";
orb = ORB.init(args, null);
// get reference to rootpoa & activate the POAManager
POA rootpoa = POAHelper.narrow(orb
.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
try {
dynAnyFactory =
DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory"));
} catch (InvalidName invalidName) {
invalidName.printStackTrace();
}
org.omg.CORBA.Object objRef = orb
.resolve_initial_references("NameService");
NamingContextExt narrow = NamingContextExtHelper.narrow(objRef);
// 3.1 Get Reference to EMSSessionFactory
NameComponent[] name = new NameComponent[1];
name[0] = new NameComponent("ZTE/T3", "EMSFactory");
org.omg.CORBA.Object obj = narrow.resolve(name);
EmsSessionFactory_I mEmsFactory = EmsSessionFactory_IHelper
.narrow(obj);
// 开始准备登陆并且获取EmsSession!
// create servant and register it with the ORB
NmsSessionImpl nmsSessionImpl = new NmsSessionImpl();
NmsSession_IPOATie tie = new NmsSession_IPOATie(nmsSessionImpl, rootpoa);
// obtain the objectRef for the tie
// this step also implicitly activates the the object
csession = tie._this(orb);
sessionHolder = new EmsSession_IHolder();
mEmsFactory.getEmsSession("deyun2", "Deyun!123", csession,
sessionHolder);
emsSession = sessionHolder.value;
Common_IHolder mgrHolder3 = new Common_IHolder();
emsSession.getManager("ManagedElement", mgrHolder3);
meMgr = ManagedElementMgr_IHelper.narrow(mgrHolder3.value);
}
public void ping() {
try {
emsSession.ping();
log.info("ping");
} catch (Exception e) {
log.error("ping失败,重新登录", e);
}
}
}
每10秒调用一次ping方法,在windows上运行没有任何问题,但是放在centos上运行1分钟左右就会抛出异常,导致通信中断,必须重新登录才能通信,但是还会在会重复同样的问题, 这样一直登录不是一个办法,求大神解救下!
异常详情:
. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |__, | / / / /
=|_|======|/=////
:: Spring Boot :: (v2.3.5.RELEASE)
{1}
22:28:38.901 [main] INFO org.omg.CollectApplication - Starting CollectApplication v0.0.1-SNAPSHOT on NameService with PID 2766735 (/work/java/CorbaDemo-0.0.1-SNAPSHOT.jar started by root in /work/java)
22:28:38.907 [main] INFO org.omg.CollectApplication - No active profile set, falling back to default profiles: default
22:28:44.677 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data Elasticsearch repositories in DEFAULT mode.
22:28:56.716 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 11807ms. Found 1 Elasticsearch repository interfaces.
22:28:57.114 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data Reactive Elasticsearch repositories in DEFAULT mode.
22:29:02.158 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 5043ms. Found 0 Reactive Elasticsearch repository interfaces.
22:29:20.357 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
22:29:20.453 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
22:29:20.461 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
22:29:20.462 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.39]
22:29:21.272 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
22:29:21.272 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 42044 ms
22:29:22.267 [main] INFO o.s.s.c.ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
22:29:24.243 [main] WARN o.s.data.convert.CustomConversions - Registering converter from class org.springframework.data.geo.Point to interface java.util.Map as writing converter although it doesn't convert to a store-supported type! You might want to check your annotation setup at the converter implementation.
22:29:24.243 [main] WARN o.s.data.convert.CustomConversions - Registering converter from interface java.util.Map to class org.springframework.data.geo.Point as reading converter although it doesn't convert from a store-supported type! You might want to check your annotation setup at the converter implementation.
22:29:24.244 [main] WARN o.s.data.convert.CustomConversions - Registering converter from class org.springframework.data.elasticsearch.core.geo.GeoPoint to interface java.util.Map as writing converter although it doesn't convert to a store-supported type! You might want to check your annotation setup at the converter implementation.
22:29:24.244 [main] WARN o.s.data.convert.CustomConversions - Registering converter from interface java.util.Map to class org.springframework.data.elasticsearch.core.geo.GeoPoint as reading converter although it doesn't convert from a store-supported type! You might want to check your annotation setup at the converter implementation.
22:29:24.465 [main] INFO o.s.d.e.support.VersionInfo - Version Spring Data Elasticsearch: 4.0.5.RELEASE
22:29:24.465 [main] INFO o.s.d.e.support.VersionInfo - Version Elasticsearch Client in build: 7.6.2
22:29:24.465 [main] INFO o.s.d.e.support.VersionInfo - Version Elasticsearch Client used: 7.12.0
22:29:24.465 [main] WARN o.s.d.e.support.VersionInfo - Version mismatch in between Elasticsearch Clients build/use: 7.6.2 - 7.12.0
22:29:24.701 [main] WARN o.s.d.e.r.s.AbstractElasticsearchRepository - Cannot create index: Connection refused; nested exception is java.lang.RuntimeException: Connection refused
22:29:24.827 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
22:29:24.888 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path ''
22:29:24.908 [main] INFO org.omg.CollectApplication - Started CollectApplication in 48.113 seconds (JVM running for 51.281){1}
22:29:25.537 [pool-2-thread-1] INFO com.dx.corba.TestPtp - ping
22:29:35.677 [pool-2-thread-1] INFO com.dx.corba.TestPtp - ping
22:29:45.768 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:29:55.673 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:05.571 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:15.645 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:25.681 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:35.595 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:45.595 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:30:55.655 [pool-2-thread-2] INFO com.dx.corba.TestPtp - ping
22:31:05.741 [pool-2-thread-2] ERROR com.dx.corba.TestPtp - ping失败,重新登录
org.omg.CORBA.OBJ_ADAPTER: ----------BEGIN server-side stack trace----------
connection closed: adapter inactive
----------END server-side stack trace----------
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:921)
at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:116)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:590)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:489)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:373)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:148)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:475)
at org.omg.zx.emsSession._EmsSession_IStub.ping(_EmsSession_IStub.java:122)
at com.dx.corba.TestPtp.ping(TestPtp.java:123)
at org.omg.runner.TaskRunner.lambda$transferAlarm$0(TaskRunner.java:93)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)