我正在使用 Weblogic 10.3.6、Mojarra 2.0.9 和 EJB3。我们有 @ViewScoped 和 @SessionScoped JSF 托管 bean,我们要求在服务器出现故障的情况下仍然可以继续使用。我刚刚破解了它,直到在 JSF Beans 上使用 EJB 注入遇到问题。这是简化的豆子
EJB 接口
@JNDIName("our.ejb.jndiname")
@Remote
public interface OurEJBInterface {
some methods...
}
EJB Bean
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class ourBean implements OurEJBInterface {
the methods...
}
JSF 支持 Bean
@ManagedBean
@ViewScoped
public class OurBackingBean {
@EJB
private OurBeanBeanInterface ourBeanBeanInterface ;
public void submit()
{
ourBeanBeanInterface.doSomethingFromBean();
}
}
当我们模拟故障转移时,会从新服务器正确检索会话,但是对 EJB 的引用仍然指向旧服务器,我们会收到以下错误:
javax.ejb.EJBException: Could not establish a connection with -1977369784351278190S:MCPVMWLS01:[7030,7030,-1,-1,-1,-1,-1]:Destin8ShowCase:JVM01, java.rmi.ConnectException: Destination unreachable; nested exception is:
java.io.IOException: Empty server reply; No available router to destination; nested exception is:
java.rmi.ConnectException: Destination unreachable; nested exception is:
java.io.IOException: Empty server reply; No available router to destination; nested exception is: java.rmi.ConnectException: Destination unreachable; nested exception is:
java.io.IOException: Empty server reply; No available router to destination
java.rmi.ConnectException: Destination unreachable; nested exception is:
java.io.IOException: Empty server reply; No available router to destination
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:470)
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:402)
at weblogic.rjvm.RJVMImpl.ensureConnectionEstablished(RJVMImpl.java:306)
at weblogic.rjvm.RJVMImpl.getOutputStream(RJVMImpl.java:350)
at weblogic.rjvm.RJVMImpl.getRequestStreamInternal(RJVMImpl.java:612)
at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:563)
at weblogic.rjvm.RJVMImpl.getOutboundRequest(RJVMImpl.java:789)
at weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:159)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:211)
at com.mcpplc.destin8.ejbs.manifestenquiry.ManifestEnquiryFacadeBean_qzni2o_ManifestEnquiryFacadeBeanInterfaceImpl_1036_WLStub.doMEQ02(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy286.doMEQ02(Unknown Source)
at com.mcpplc.destin8.web.jsf.backingbeans.imports.Meq02BackingBean.customProcessing(Meq02BackingBean.java:49)
at com.mcpplc.destin8.web.jsf.backingbeans.BackingBean.submit(BackingBean.java:179)
有没有办法让托管 Bean 重新初始化指向新服务器的新 EJB 引用?
我知道我可以使用将 init 放在提交方法中的服务定位器,但如果可能的话,我想使用 @EJB。
提前致谢。