Announcement Announcement Module
Collapse
No announcement yet.
Rmi in JSF giving connect problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rmi in JSF giving connect problem

    Hi,

    I am currently trying to implement RMI in a already existing JSF project. Idea is to have two independent application where one of them exposes it MBeans through RMI (as server) and JSF application (client) will connect via RMI and display the Mbeans values. It works absolutely fine initially, but the problem occurs when the user of JSF application tries to logout and login its session, client is not able to connect back to the same RMI connection, and throws exceptions,until the client (JSF app) has to be restarted again. Note that nowhere server is restarted in between. Also calls to the classes are made with scope - 'request' which i think makes it independent of user login-logout session problem.

    Below is the implementation of spring on both server and client side:

    Server:

    Code:
    <bean id="myLoadTestMBean"
    		class="com.package.subpackage.myLoadTestMBean"
    		scope="singleton" lazy-init="true" />
    
    <bean id="myRMIServiceExporter" class="org.springframework.remoting.rmi.RmiServiceExporter">
    	<property name="serviceName" value="connector" />
    	<property name="service" ref="myLoadTestMBean" />
    	<property name="serviceInterface"
    			value="com.package.subpackage.myAppInterface" />
    	<property name="registryPort">
    			<value>8884</value>
    	</property>
    </bean>
    Client:

    Code:
    <bean id="myRMIProxyFactoryBean" class="org.springframework.remoting.rmi.RmiProxyFactoryBean"
    		lazy-init="true" scope="singleton">
    		<property name="serviceUrl">
    			<value>rmi://localhost:8884/connector</value>
    		</property>
    		<property name="serviceInterface">
    			<value>com.package.subpackage.myAppInterface
    			</value>
    		</property>
    		<property name="refreshStubOnConnectFailure">
    			<value>true</value>
    		</property>
    		<property name="lookupStubOnStartup">
    			<value>true</value>
    		</property>
    		 <property name="cacheStub">
    			 <value>true</value>
    		</property>
    	</bean>
    Here is the exception log generated:

    Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    java.io.IOException: HTTP request failed
    org.springframework.remoting.RemoteLookupFailureEx ception: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    java.io.IOException: HTTP request failed
    at org.springframework.remoting.rmi.RmiClientIntercep tor.lookupStub(RmiClientInterceptor.java:214)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.getStub(RmiClientInterceptor.java:231)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:256)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy64.getCoreIncidentLastUpdate(Unknown Source)
    at com.package.subpackage.getSomeVaue(myAppJMX.java:2 67)
    at sun.reflect.GeneratedMethodAccessor245.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.el.BeanELResolver.getValue(BeanELResolver.ja va:62)
    at javax.el.CompositeELResolver.getValue(CompositeELR esolver.java:53)
    at com.sun.faces.el.FacesCompositeELResolver.getValue (FacesCompositeELResolver.java:64)
    at org.apache.el.parser.AstValue.getValue(AstValue.ja va:97)
    at org.apache.el.parser.AstDeferredExpression.getValu e(AstDeferredExpression.java:26)
    at org.apache.el.parser.AstCompositeExpression.getVal ue(AstCompositeExpression.java:31)
    at org.apache.el.ValueExpressionImpl.getValue(ValueEx pressionImpl.java:186)
    at com.sun.facelets.el.TagValueExpression.getValue(Ta gValueExpression.java:71)
    at javax.faces.component.UIOutput.getValue(UIOutput.j ava:173)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputR enderer.getValue(HtmlBasicInputRenderer.java:189)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.getCurrentValue(HtmlBasicRenderer.java:320)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRender er.encodeEnd(HtmlBasicRenderer.java:200)
    at javax.faces.component.UIComponentBase.encodeEnd(UI ComponentBase.java:833)
    at org.apache.myfaces.trinidad.component.UIXComponent Base.__encodeRecursive(UIXComponentBase.java:1262)
    at org.apache.myfaces.trinidad.component.UIXComponent Base.__encodeRecursive(UIXComponentBase.java:1257)
    at org.apache.myfaces.trinidad.component.UIXComponent Base.__encodeRecursive(UIXComponentBase.java:1257)
    at org.apache.myfaces.trinidad.component.UIXComponent Base.encodeAll(UIXComponentBase.java:713)
    at javax.faces.component.UIComponent.encodeAll(UIComp onent.java:892)
    at com.sun.facelets.FaceletViewHandler.renderView(Fac eletViewHandler.java:571)
    at org.apache.myfaces.trinidadinternal.application.Vi ewHandlerImpl.renderView(ViewHandlerImpl.java:182)
    at com.sun.faces.lifecycle.RenderResponsePhase.execut e(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(Lifecy cleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(Lifec ycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServl et.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at com.package.subpackage.myEncoding.doFilter(myEncod ing.java:23)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter. doFilter(ExtensionsFilter.java:301)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at com.package.subpackage.mySessionTimeOutNotifier.do Filter(mySessionTimeOutNotifier.java:84)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionV alve.invoke(CachedConnectionValve.java:156)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:580)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    java.io.IOException: HTTP request failed
    at sun.rmi.transport.StreamRemoteCall.executeCall(Str eamRemoteCall.java:209)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:3 59)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:84)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.lookupStub(RmiClientInterceptor.java:199)
    ... 60 more
    Caused by: java.io.IOException: HTTP request failed
    at sun.rmi.transport.proxy.HttpSendSocket.readNotify( HttpSendSocket.java:159)
    at sun.rmi.transport.proxy.HttpSendInputStream.read(H ttpSendInputStream.java:66)
    at java.io.BufferedInputStream.fill(BufferedInputStre am.java:218)
    at java.io.BufferedInputStream.read(BufferedInputStre am.java:237)
    at java.io.DataInputStream.readByte(DataInputStream.j ava:248)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Str eamRemoteCall.java:195)
    ... 64 more
    I am a newbie in this, can anybody help me please what am i doing wrong here??

    Thanks!!!
    - Akshay

  • #2
    how about to remove the following lines?

    Code:
    <property name="refreshStubOnConnectFailure">
    			<value>true</value>
    		</property>
    		<property name="lookupStubOnStartup">
    			<value>true</value>
    		</property>
    		 <property name="cacheStub">
    			 <value>true</value>
    		</property>

    Comment

    Working...
    X