发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 CQRS 扩展性 并发编程 事件溯源 分布式 SOA

请教:当EJB服务重启之后,客户如何再次调用EJB?

2004-11-26 15:16
赞助商链接

我在开发过程中遇到这样的问题:
客户端为Web应用,服务端为SessionBean,两者位于不同的物理设备。客户端在启动时调用InitialContext.lookup(name)获取EJBHome。当服务端应用重新启动之后,客户端如果尝试调用EJBHome.create(),则程序抛出异常ClassCastException。
最初,为了解决这个问题,我在客户端程序中捕获ClassCastException,然后重新生成InitialContext对象并获取新的EJBHome对象。但调用其create方法时依然得到ClassCastException,请问为什么会出现这种情况,如何解决?

注:
1)客户程序和服务段程序都运行在WebSphere5.0.2
2)异常信息如下:
[04-11-26 14:41:23:931 CST] 75a910a7 ExceptionUtil E CNTR0019E: 处理方法"create"时发生非程序异常。异常数据:java.lang.ClassCastException: com.datawise.fiis.iframework.ejb.EJSStatelessControllerFacadeHomeBean_ff943650
at com.datawise.fiis.iframework.ejb.EJSRemoteStatelessControllerFacadeHome_ff943650.create(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.CORBA.iiop.ClientDelegate$3.run(ClientDelegate.java(Compiled Code))
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java(Compiled Code))
at $Proxy140.create(Unknown Source)
at com.datawise.fiis.iframework.ejb._ControllerFacadeHome_Stub.create(_ControllerFacadeHome_Stub.java:230)
at com.icbc.dcmcs.call.DelegateImpl.getControllerFacade(DelegateImpl.java:92)
at com.icbc.dcmcs.call.DelegateImpl.delegate(DelegateImpl.java:73)
at com.icbc.dcmcs.call.util.DelegateHelper.delegate(DelegateHelper.java:69)
at com.icbc.dcm.client.action.DcmInvokeAction.execute(DcmInvokeAction.java:97)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java(Compiled Code))
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java(Compiled Code))
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java(Compiled Code))
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

2004-12-11 11:06

是这样的,因为EJBObject在Web服务器的引用已经没有了,我认为只有全部(包括Web服务器)重新启动了,或者Web服务器包重新部署一下。

这其实是J2EE生命周期的问题。

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系反馈 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com