2 Replies Latest reply on Jan 31, 2008 7:36 AM by Pete Muir

    @Name annotation on JSF controllers

    Kirill Y. Tsibriy Newbie

      Hi All,

      I am trying out SEAM in the following way:

      I have a bean that used to be JSF managed bean. It's class is available at WEB-INF/classes. I annotate it with @Name("CartJSFBean"). Here is a piece of JBoss deployment logs that (to my mind) shows that bean is found and deployed by SEAM.

      21:29:18,980 INFO [Component] Component: CartJSFBean, scope: SESSION, type: STATELESS_SESSION_BEAN, class: z.jsf.beans.CartJSFBean, JNDI: cartapp/CartJSFBean/local
      


      In my faces-config.xml I do not have an entity resolver specified because it messes up application deployment.

      When I refer the bean in the JSP as #{CartJSFBean} I get the following error:
      21:11:32,406 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@20cc11) threw exception
      javax.faces.FacesException: org.apache.jasper.JasperException: An exception occurred processing JSP page /carts.jsp at line 11
      
      8: <head><title>Orders page</title></head>
      9: <body>
      10: <h:form>
      11: <h:dataTable value="#{CartJSFBean.carts}" var="cart"
      12: cellspacing="3" first="0" rules="all" binding="#{CartJSFBean.dataTable}">
      13: <h:column>
      14: <f:facet name="header">
      
      
      Stacktrace:
       at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:413)
       at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:439)
       at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:114)
       at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:87)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(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.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.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: org.apache.jasper.JasperException: An exception occurred processing JSP page /carts.jsp at line 11
      
      8: <head><title>Orders page</title></head>
      9: <body>
      10: <h:form>
      11: <h:dataTable value="#{CartJSFBean.carts}" var="cart"
      12: cellspacing="3" first="0" rules="all" binding="#{CartJSFBean.dataTable}">
      13: <h:column>
      14: <f:facet name="header">
      
      
      Stacktrace:
       at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:518)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
       ... 25 more
      Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.naming.NameNotFoundException: CartJSFBean not bound
       at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:851)
       at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
       at org.apache.jsp.carts_jsp._jspService(carts_jsp.java:87)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
       ... 35 more
      Caused by: javax.naming.NameNotFoundException: CartJSFBean not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1279)
       at org.jboss.seam.Component.instantiate(Component.java:1265)
       at org.jboss.seam.Component.newInstance(Component.java:1958)
       at org.jboss.seam.Component.getInstance(Component.java:1865)
       at org.jboss.seam.Component.getInstance(Component.java:1832)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
       at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
       at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
       at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:205)
       at org.jboss.seam.jsf.SeamApplication.createComponent(SeamApplication.java:327)
       at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:211)
       at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:476)
       at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:660)
       at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1111)
       at com.sun.faces.taglib.html_basic.DataTableTag.doStartTag(DataTableTag.java:372)
       at org.apache.jsp.carts_jsp._jspx_meth_h_005fdataTable_005f0(carts_jsp.java:204)
       at org.apache.jsp.carts_jsp._jspx_meth_h_005fform_005f0(carts_jsp.java:160)
       at org.apache.jsp.carts_jsp._jspx_meth_f_005fview_005f0(carts_jsp.java:117)
       at org.apache.jsp.carts_jsp._jspService(carts_jsp.java:80)
       ... 38 more


      Another weird thing happens when I try to specify EL-resolver in faces-config. During deployment I get the following:

      ERROR [STDERR] java.lang.UnsupportedOperationException
      ERROR [STDERR] at com.sun.faces.config.ConfigureListener$InitFacesContext.getViewRoot(ConfigureListener.java:1690)
      ERROR [STDERR] at com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:113)
      ERROR [STDERR] at com.sun.faces.util.MessageUtils.getExceptionMessageString(MessageUtils.java:277)
      ERROR [STDERR] at com.sun.faces.util.Util.createInstance(Util.java:477)
      ERROR [STDERR] at com.sun.faces.util.Util.createInstance(Util.java:436)
      ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:617)
      ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:503)
      ERROR [STDERR] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:402)
      ERROR [STDERR] at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:69)
      ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
      ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
      ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
      ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
      ERROR [STDERR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor226.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
      ERROR [STDERR] at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
      ERROR [STDERR] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      ERROR [STDERR] at org.jboss.web.WebModule.startModule(WebModule.java:83)
      ERROR [STDERR] at org.jboss.web.WebModule.startService(WebModule.java:61)
      ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      ERROR [STDERR] at $Proxy0.start(Unknown Source)
      ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:417)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      ERROR [STDERR] at $Proxy45.start(Unknown Source)
      ERROR [STDERR] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      ERROR [STDERR] at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      ERROR [STDERR] at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      ERROR [STDERR] at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:93)
      ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      ERROR [STDERR] at $Proxy46.start(Unknown Source)
      ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
      ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
      ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
      ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
      ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      ERROR [[/cartapp]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener


      Any ideas on any of these problems are highly appreciated.
      Thanks.