我正在使用JBoss EAP 6.4来部署EJB ear文件。一切正常但如果Swing应用程序闲置一段时间(1小时左右)然后尝试访问swing客户端的任何功能,客户端崩溃了以下异常:
javax.naming.NamingException: Unable to invoke lookup, status=WAITING
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:98)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:275)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:132)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:271)
at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)
at javax.naming.InitialContext.lookup(Unknown Source)
它无法在客户端使用缓存上下文解析jndi。
使用以下属性在客户端中创建的上下文:
table.put("remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
table.put("remote.connection.one.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
table.put("remote.clusters", "ejb");
table.put("remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
table.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
table.put("jboss.naming.client.ejb.context", true);
table.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
table.put( Context.SECURITY_PRINCIPAL, System.getProperty( Context.SECURITY_PRINCIPAL));
table.put( Context.SECURITY_CREDENTIALS, System.getProperty( Context.SECURITY_CREDENTIALS));
table.put("jboss.naming.client.remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED","true");
table.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS","true");
table.put("jboss.naming.client.connect.timeout", "3000000");
table.put( Context.PROVIDER_URL,PROVIDER_URL);
context = new javax.naming.InitialContext( table);
请帮助我理解为什么在空闲时间上下文无法查找之后?
答案 0 :(得分:0)
最后我找到了解决方案。在JBoss EAP 6.4中,使用旧的JNDI方法会产生问题,并且不支持像HeartBeat_Interval等JBoss功能。
在Jboss中查找的最佳方法是使用EJB Client查找approch。这解决了与崩溃等相关的所有问题。 https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project