3 Replies Latest reply on Jul 16, 2008 10:12 PM by Guillaume Jeudy

    Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1

    Matt Cheely Newbie

      I've created the following seam component in a new seam-gen project



      package org.jboss.helloworld;
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.Scope;
      
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("testAction")
      public class TestAction implements TestActionInterface {
      
           @Out
           public String foo = "test";
           
           @Remove
           public void destroy() {}
           
      }




      package org.jboss.helloworld;
      
      import javax.ejb.Local;
      
      @Local
      public interface TestActionInterface {
      
           public void destroy();
           
      }




      And here's the jsf page that references the component:



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:rich="http://richfaces.org/rich"
                      template="layout/template.xhtml">
      
      <ui:define name="body">
           <h:messages globalOnly="true" styleClass="message"/>
           
                <rich:panel>
                     <f:facet name="header">Test</f:facet>
           
                     <h:outputText value="#{testAction.foo}"/>
                     
                </rich:panel>
      
      </ui:define>
      </ui:composition>



      This seems like something incredibly basic that should work, but when I point my browser at the page, I get this error:



      javax.faces.FacesException: javax.el.PropertyNotFoundException: /testPage.xhtml @18,45 value="#{testAction.foo}": Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
           at javax.faces.component.UIOutput.getValue(UIOutput.java:176)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200)
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
           at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
           at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
           at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
           at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
           at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
           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.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.PropertyNotFoundException: /testPage.xhtml @18,45 value="#{testAction.foo}": Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
           at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
           ... 56 more




      It looks like the JSF page is trying to access the component as a basic java Object, but I can't imagine why. I can copy examples from the Seam documentation and they seem to work fine, so I don't think there's an issue with my setup. Can anybody see why this code doesn't work?


        • 1. Re: Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
          Guillaume Jeudy Master

          try:


          <h:outputText value="#{foo}"/>



          if you really need:


          <h:outputText value="#{testAction.foo}"/>



          You need to add a getter: getFoo(). The above EL expression is a property access so by java beans standard you need a getter. You may also need a setter, I don't recall, I use the first form more often than not.

          • 2. Re: Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
            Matt Cheely Newbie

            Thanks, Guillaume. I'm new to EJB as well as seam.



            <h:outputText value="#{foo}"/>



            Didn't work for me - the page rendered without error, but it was just blank.


            However, adding a getter and using #{testAction.foo} did work, and that's the behavior I'm looking for.


            I had thought I didn't need a getter since some of the examples used EJB's without getters, but I see now upon looking closer that they were just using something like #{foo} to access the property. Just out of curiosity - what happens if you access your properties in that method and you have two components that both outject something called 'name', for example? Do they just clobber each other?


            • 3. Re: Property 'foo' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
              Guillaume Jeudy Master

              You have to trigger an action on testAction otherwise foo will never get outjected in the SESSION scope, that's why it evaluates to blank.


              If you outject 2 vars called name from 2 components, one might overwrite the other or shadow it, depending into which scope you outject the var.


              For example if you have 2 components participating in the same conversation and outject name to CONVERSATION scope, then the last component to outject will overwrite 'name'.


              However if your 2 components participate in separate CONVERSATIONs then no overwriting will occur and each component will outject it's name value with no side-effect.


              If you outject to SESSION in 1 component and to CONVERSATION in the other component then depending on how you inject name back may get one or the other. I suggest you read up on Seam contexts and bijection in general:
              Section 4.1, 4.2, 4.3 of Seam doc.


              Seam Contexts