2 Replies Latest reply on Jan 22, 2009 10:26 PM by Daniel Deneka

    Stateful remote EJB problem

    Daniel Deneka Newbie

      Hello!


      I have a problem when trying to use remote stateful beans in my seam project. Remote stateless beans from the same server work fine. But when I try to use a stateful one, I've get the ClassCastException with message something like classcastexception com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow and $Proxy123 cannot be cast to MyRemoteInterface.


      If someone have experience in using remote stateful beans in seam application,      
      please post some example code.


      I'm using Seam 2.1.1 on Jboss 4.2.3 GA


      Any help would be appreciated!:)

        • 1. Re: Stateful remote EJB problem
          Coen Damen Novice

          If you would post the exact stacktrace, this would be more helpful.


          Also, post the code your are using to lookup the Remote.


          Cheers,
          Coen

          • 2. Re: Stateful remote EJB problem
            Daniel Deneka Newbie

            Hello,


            The stack trace was:



            22:23:34,795 ERROR [STDERR] java.lang.ClassCastException: $Proxy130 cannot be cast to pl.ddeneka.server.session.UslugaEjbRemote
            22:23:34,795 ERROR [STDERR]      at pl.ddeneka.client.session.Client.zalogujZdalnie(Client.java:28)
            22:23:34,795 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            22:23:34,795 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            22:23:34,795 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            22:23:34,795 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
            22:23:34,795 ERROR [STDERR]      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
            22:23:34,795 ERROR [STDERR]      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
            22:23:34,796 ERROR [STDERR]      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
            22:23:34,797 ERROR [STDERR]      at pl.ddeneka.client.session.Client_$$_javassist_1.zalogujZdalnie(Client_$$_javassist_1.java)
            22:23:34,797 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            22:23:34,797 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            22:23:34,797 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            22:23:34,797 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:597)
            22:23:34,797 ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
            22:23:34,797 ERROR [STDERR]      at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
            22:23:34,797 ERROR [STDERR]      at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
            22:23:34,797 ERROR [STDERR]      at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            22:23:34,797 ERROR [STDERR]      at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            22:23:34,797 ERROR [STDERR]      at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
            22:23:34,797 ERROR [STDERR]      at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
            22:23:34,797 ERROR [STDERR]      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
            22:23:34,797 ERROR [STDERR]      at javax.faces.component.UICommand.broadcast(UICommand.java:387)
            22:23:34,797 ERROR [STDERR]      at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
            22:23:34,797 ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
            22:23:34,797 ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
            22:23:34,797 ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
            22:23:34,798 ERROR [STDERR]      at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
            22:23:34,798 ERROR [STDERR]      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
            22:23:34,798 ERROR [STDERR]      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
            22:23:34,798 ERROR [STDERR]      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
            22:23:34,798 ERROR [STDERR]      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
            22:23:34,798 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            22:23:34,798 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            22:23:34,798 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            22:23:34,798 ERROR [STDERR]      at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
            22:23:34,798 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,798 ERROR [STDERR]      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            22:23:34,798 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,851 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            22:23:34,851 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            22:23:34,851 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            22:23:34,851 ERROR [STDERR]      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            22:23:34,851 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,852 ERROR [STDERR]      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            22:23:34,852 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,852 ERROR [STDERR]      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
            22:23:34,852 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            22:23:34,852 ERROR [STDERR]      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            22:23:34,852 ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            22:23:34,852 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
            22:23:34,852 ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            22:23:34,852 ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            22:23:34,852 ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            22:23:34,852 ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            22:23:34,852 ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            22:23:34,852 ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            22:23:34,852 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:619)




            I was able to solve this problem, by removing the copy of remote interface from my app.
            I was testing this problem at home on my local server, with client and server app on it. I had a copy of remote interface in the client app. Removing it from both client and server, and packing it to stand alone jar file, placed in jboss lib directory solved the problem.


            Thanks for your time!


            Regards, Daniel