2 Replies Latest reply on Feb 18, 2007 3:40 AM by Jeroen Wenting

    JBoss 4.05 GA Stateless Session Bean JNDI lookup ClassCastEx

    Thomas Sewenig Newbie

      Hi,

      I'm getting a strange ClassCastException when trying to lookup a Stateless Session Bean from within my myfaces managed bean. What I'm doing is simply call

      SicherheitsDatenBean sdb = (SicherheitsDatenBean) CTX.lookup("JSF-REACH/SicherheitsDatenBean/local");
      


      to obtain a bean instance from FacesContext CTX.

      The bean is registered in JNDI under that name, I can see it in my JBoss' jmx console (JBoss version 4.05 GA):
      +- JSF-REACH (class: org.jnp.interfaces.NamingContext)
       | +- SicherheitsDatenBean (class: org.jnp.interfaces.NamingContext)
       | | +- local (proxy: $Proxy104 implements interface business.SicherheitsDaten,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      


      This is the exception:
      12:15:05,671 ERROR [STDERR] java.lang.ClassCastException: $Proxy104
      12:15:05,671 ERROR [STDERR] at facesBeans.Questionnaire.<init>(Questionnaire.java:43)
      12:15:05,671 ERROR [STDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      12:15:05,671 ERROR [STDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      12:15:05,671 ERROR [STDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      12:15:05,671 ERROR [STDERR] at java.lang.reflect.Constructor.newInstance(Unknown Source)
      12:15:05,671 ERROR [STDERR] at java.lang.Class.newInstance0(Unknown Source)
      12:15:05,671 ERROR [STDERR] at java.lang.Class.newInstance(Unknown Source)
      12:15:05,671 ERROR [STDERR] at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
      12:15:05,671 ERROR [STDERR] at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:265)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:50)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
      12:15:05,687 ERROR [STDERR] at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
      12:15:05,687 ERROR [STDERR] at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
      12:15:05,687 ERROR [STDERR] at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
      12:15:05,687 ERROR [STDERR] at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
      12:15:05,687 ERROR [STDERR] at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
      12:15:05,687 ERROR [STDERR] at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495)
      12:15:05,687 ERROR [STDERR] at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
      12:15:05,687 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspx_meth_h_inputText_0(questionnaire_jsp.java:438)
      12:15:05,687 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspx_meth_h_form_0(questionnaire_jsp.java:383)
      12:15:05,687 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspx_meth_f_subview_0(questionnaire_jsp.java:356)
      12:15:05,687 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspx_meth_t_div_4(questionnaire_jsp.java:329)
      12:15:05,718 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspx_meth_f_view_0(questionnaire_jsp.java:184)
      12:15:05,718 ERROR [STDERR] at org.apache.jsp.docs.pages.main.questionnaire_jsp._jspService(questionnaire_jsp.java:97)
      12:15:05,718 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      12:15:05,718 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      12:15:05,718 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
      12:15:05,718 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      12:15:05,718 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      12:15:05,718 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      12:15:05,718 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      12:15:05,718 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:15:05,718 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      12:15:05,718 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      12:15:05,718 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      12:15:05,734 ERROR [STDERR] at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
      12:15:05,734 ERROR [STDERR] at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
      12:15:05,734 ERROR [STDERR] at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
      12:15:05,734 ERROR [STDERR] at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:222)
      12:15:05,734 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
      12:15:05,734 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:15:05,734 ERROR [STDERR] at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:15:05,734 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      12:15:05,734 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      12:15:05,734 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      12:15:05,734 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      12:15:05,734 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      12:15:05,734 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      12:15:05,734 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      12:15:05,734 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      12:15:05,734 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      12:15:05,734 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
      


      any ideas?

      Thanks!

      TS