Results 1 to 4 of 4

Thread: refresh-home-on-connect-failure no catching NoSuchObjectException

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Posts
    15

    Default refresh-home-on-connect-failure no catching NoSuchObjectException

    Hello,

    I have a problem with the refresh-home-on-connect-failure attribute. My front end use an remote ejb which I declare like this:

    Code:
    <jee:remote-slsb id="contingentService" jndi-name="${service.jndi.url}"
              business-interface="MyService"
              lookup-home-on-startup="true" refresh-home-on-connect-failure="true">
    </jee:remote-slsb>
    When I restart my backend (without restarting my frontend), I get an exception like this :

    Code:
    javax.ejb.EJBException: The object identified by: '312' could not be found.  Either it was has not been exported or it has been collected by the distributed garbage collector.; nested exception is: java.rmi.NoSuchObjectException: The object identified by: '312' could not be found.  Either it was has not been exported or it has been collected by the distributed garbage collector.
    	at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:123)
    	at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:102)
    	at $Proxy184.getLimitedWorkerInformation(Unknown Source)
    	at sun.reflect.GeneratedMethodAccessor483.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invokeRemoteMethod(RmiClientInterceptorUtils.java:108)
    	at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:98)
    	at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invokeInContext(AbstractRemoteSlsbInvokerInterceptor.java:137)
    	at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:191)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy185.getLimitedWorkerInformation(Unknown Source)
    	at be.smals.contingent.web.components.controller.OverviewContingentController.init(OverviewContingentController.java:39)
    	at sun.reflect.GeneratedMethodAccessor482.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod(WebContainerInjectionProvider.java:113)
    	at com.sun.faces.vendor.WebContainerInjectionProvider.invokePostConstruct(WebContainerInjectionProvider.java:95)
    	at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:223)
    	at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
    	at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
    	at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
    	at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
    	at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
    	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    	at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:68)
    	at com.sun.el.parser.AstValue.getValue(AstValue.java:107)
    	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
    	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:193)
    	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:181)
    	at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
    	at sun.reflect.GeneratedMethodAccessor396.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.sun.faces.facelets.util.DevTools.writeAttributes(DevTools.java:375)
    	at com.sun.faces.facelets.util.DevTools.writeStart(DevTools.java:424)
    	at com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:245)
    	at com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
    	at com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:256)
    	at com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
    	at com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
    	at com.sun.faces.facelets.util.DevTools.debugHtml(DevTools.java:181)
    	at com.sun.faces.facelets.tag.ui.UIDebug.writeDebugOutput(UIDebug.java:137)
    	at com.sun.faces.facelets.tag.ui.UIDebug.encodeBegin(UIDebug.java:122)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1672)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
    	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
    	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
    	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.rmi.NoSuchObjectException: The object identified by: '312' could not be found.  Either it was has not been exported or it has been collected by the distributed garbage collector.
    	at weblogic.rmi.internal.OIDManager.getServerReference(OIDManager.java:251)
    	at weblogic.rmi.internal.CollocatedRemoteRef.getOutboundRequest(CollocatedRemoteRef.java:51)
    	at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:211)
    	at Service_pyaozn_ServiceImpl_1033_WLStub.getInformation(Unknown Source)
    	at sun.reflect.GeneratedMethodAccessor484.invoke(Unknown Source)
    	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:84)
    	... 69 more
    It seems that the EJBException (caused by the NoSuchObjectException) is not catch and the refresh-home-on-connect-failure is not triggered.

    If I set cache-home=false, the problem doesn't occur anymore but I would prefer to keep cache-home=true for performance issues.

    Can anyone help me?

    Thanks,

    Stéphane

  2. #2
    Join Date
    Apr 2011
    Posts
    15

    Default

    Up please...

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    I suggest a read of the javadoc... Spring expects a certain rmi exception (a couple of them) and not an EJBException. You could extend the SimpleRemoteStatelessSessionProxyFactoryBean and override the doInvoke method, and catch EJBException and when the targetException is connection exception handle it else rethrow.

    Code:
    protected Object doInvoke(MethodInvocation invocation) throws Throwable {
    		Object ejb = null;
    		try {			
    			return super.doInvoke(invocation);
    		} catch (EJBException ex) {
    			Throwable targetEx = ex.getTargetException();
    			if (targetEx instanceof RemoteException) {
    				RemoteException rex = (RemoteException) targetEx;
    				throw RmiClientInterceptorUtils.convertRmiAccessException(
    				    invocation.getMethod(), rex, isConnectFailure(rex), getJndiName());
    			}
    			else if (targetEx instanceof CreateException) {
    				throw RmiClientInterceptorUtils.convertRmiAccessException(
    				    invocation.getMethod(), targetEx, "Could not create remote EJB [" + getJndiName() + "]");
    			}
    			throw targetEx;
    		}
    }
    Drawback is that you now need to use this custom class instead of using the namespace to configure your EJB lookups.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4
    Join Date
    Apr 2011
    Posts
    15

    Default

    OK.

    Thanks for the answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •