12 Replies Latest reply on Jan 24, 2008 11:32 AM by kukeltje

    Problem with managed beans

    rodosa

      Hi!

      I'm trying to use managed beans to request parameters from my forms. But It doesn't work! This is the error:

      javax.servlet.ServletException: /120/SolicitarAlta.xhtml @25,60 value="#{UserBean.dni}": Target Unreachable, identifier 'UserBean' resolved to null
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      root cause
      
      javax.el.PropertyNotFoundException: /120/SolicitarAlta.xhtml @25,60 value="#{UserBean.dni}": Target Unreachable, identifier 'UserBean' resolved to null
       com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
       com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
       javax.faces.component.UIInput.getConvertedValue(UIInput.java:936)
       javax.faces.component.UIInput.validate(UIInput.java:861)
       javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
       javax.faces.component.UIInput.processValidators(UIInput.java:663)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIForm.processValidators(UIForm.java:229)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
       javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
       com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
       com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
       com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      


      I have created the class UserBean where you can find the atribute dni with the get & set method:

      package com.miApp;
      
      
      import java.io.Serializable;
      
      
      public class UserBean implements Serializable
      {
       private String dni;
       private String nombre;
       private String apellidos;
       private String password;
       private String ocupacion;
       private String mail;
       private String telf;
      
       public UserBean()
       {
       }
      
       public UserBean(String dni, String nombre, String apellidos, String ocupacion,
       String mail, String telf, String password)
       {
       this.dni = dni;
       this.nombre = nombre;
       this.apellidos = apellidos;
       this.password = password;
       this.ocupacion = ocupacion;
       this.mail = mail;
       this.telf = telf;
       this.password = password;
       }
      
       public void setDni(String dni)
       {
       this.dni = dni;
       }
      
       public String getDni()
       {
       return dni;
       }
      
      ....
      
      


      Also I've added in the faces-config.xml file the managed bean:

      <managed-bean>
       <managed-bean-name>userBean</managed-bean-name>
       <managed-bean-class>com.miApp.UserBean</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      


      Does anyone know where is the error?

      Thanks

        • 1. Re: Problem with managed beans
          kukeltje

          wrong casing... user userBean in stead of UserBean

          • 2. Re: Problem with managed beans
            rodosa

            I doesn't work with :

            managed-bean>
             <managed-bean-name>userBean</managed-bean-name>
             <managed-bean-class>com.miApp.UserBean</managed-bean-class>
             <managed-bean-scope>request</managed-bean-scope>
             </managed-bean>
            
            


            and it doesn't work with:

            managed-bean>
             <managed-bean-name>UserBean</managed-bean-name>
             <managed-bean-class>com.miApp.UserBean</managed-bean-class>
             <managed-bean-scope>request</managed-bean-scope>
             </managed-bean>
            
            


            It could be a problem of directories??? In which directory I have to put my UserBean.java file???


            • 3. Re: Problem with managed beans
              kukeltje

              anything where the normal classloaders can find it (so not the processclassloader).

              • 4. Re: Problem with managed beans
                rodosa

                Yes, It isn't a problem of directory ...

                This problem occurs the first time when the form is displayed.... any ideas?

                • 5. Re: Problem with managed beans
                  kukeltje

                  Yes, I have an idea.... Turn on JSF debugging and see what is going on. Correct configuration file loaded etc...

                  Oh... and btw... you should put a UserBean.class file somewhere not the .java file ;-)

                  btw2 ... is it in any way jBPM related? up to now I only see/read jsf stuff. Are they jbpm forms?

                  • 6. Re: Problem with managed beans
                    rodosa

                    When the server starts ... occurs this error:

                    2008-01-22 19:42:02,484 ERROR [STDERR] 22-ene-2008 19:42:02 com.sun.faces.config.ConfigureListener contextInitialized
                    INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b09-FCS) for context 'null'
                    2008-01-22 19:42:02,718 ERROR [STDERR] 22-ene-2008 19:42:02 com.sun.faces.spi.InjectionProviderFactory createInstance
                    ADVERTENCIA: JSF1033: Resource injection is DISABLED.
                    



                    btw2 ... is it in any way jBPM related? up to now I only see/read jsf stuff. Are they jbpm forms?


                    Yes, I've created forms with the jbpm's editor. This creates automatically the .xhtml files & I have changed it a bit to validate and request data. The code of one form is the following:

                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
                    
                    <!-- the DOCTYPE means we are required to use html for a root element -->
                    <html xmlns="http://www.w3.org/1999/xhtml"
                     xmlns:ui="http://java.sun.com/jsf/facelets"
                     xmlns:c="http://java.sun.com/jstl/core"
                     xmlns:h="http://java.sun.com/jsf/html"
                     xmlns:f="http://java.sun.com/jsf/core"
                     xmlns:tf="http://jbpm.org/jsf/tf"
                     xmlns:jbpm="http://jbpm.org/jsf">
                    
                     <ui:component>
                    
                     <jbpm:dataform>
                    
                     <f:facet name="header">
                     <h:outputText value="#{taskName}"/>
                     </f:facet>
                    
                     <!-- TASKFORM ROWS -->
                     <jbpm:datacell>
                     <f:facet name="header">
                     <h:outputText value="DNI"/>
                     </f:facet>
                     <h:inputText value="#{userBean.dni}">
                     <f:validateLength minimum="8" maximum="8"/>
                     <f:validateLongRange minimum="0" maximum="99999999"/>
                     </h:inputText>
                     </jbpm:datacell>
                    
                    ...
                    


                    With
                    <h:inputText value="#{userBean.dni}">
                    should call the method setDni() of the UserBean. When I enter in the web console the form appears well and I can fill the data. But when I press the buttom Save of the form the error appears:

                    Target Unreachable, identifier 'userBean' resolved to null


                    • 7. Re: Problem with managed beans
                      rodosa

                      I forgot tell you that when I enter in the web console the following messagings appear in the console:

                      20:11:12,812 ERROR [STDERR] 22-ene-2008 20:11:12 com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp
                      INFO: JSF1027: [null] The ELResolvers for JSF were not registered with the JSP container.
                      
                      20:11:13,046 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/gravel-14.jar!/META-INF/gravel-action.taglib.xml
                      
                      20:11:13,062 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/tf.taglib.xml
                      
                      20:11:13,078 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/identity.taglib.xml
                      
                      20:11:13,109 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/gravel-14.jar!/META-INF/gravel-compat.taglib.xml
                      
                      20:11:13,125 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57947jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                      
                      20:11:13,140 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                      
                      20:11:13,140 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57947jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                      
                      20:11:13,140 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57940gravel-14.jar!/META-INF/gravel-compat.taglib.xml
                      
                      20:11:13,156 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/tf-compat.taglib.xml
                      
                      20:11:13,156 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57940gravel-14.jar!/META-INF/gravel-action.taglib.xml
                      
                      20:11:13,156 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                      
                      20:11:13,171 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                      
                      20:11:13,187 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/tfl.taglib.xml
                      
                      20:11:13,187 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                      
                      20:11:13,203 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57940gravel-14.jar!/META-INF/gravel-nav.taglib.xml
                      
                      20:11:13,218 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57940gravel-14.jar!/META-INF/gravel-simple.taglib.xml
                      
                      20:11:13,250 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/core.taglib.xml
                      
                      20:11:13,250 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                      
                      20:11:13,281 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57940gravel-14.jar!/META-INF/gravel-data.taglib.xml
                      
                      20:11:13,281 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/gravel-14.jar!/META-INF/gravel-data.taglib.xml
                      
                      20:11:13,281 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/tfl-compat.taglib.xml
                      
                      20:11:13,296 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/tf.taglib.xml
                      
                      20:11:13,296 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57947jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                      
                      20:11:13,296 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/core.taglib.xml
                      
                      20:11:13,296 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57947jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                      
                      20:11:13,296 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/gravel-14.jar!/META-INF/gravel-nav.taglib.xml
                      
                      20:11:13,312 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/tf-compat.taglib.xml
                      
                      20:11:13,312 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/tfl.taglib.xml
                      
                      20:11:13,312 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57947jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                      
                      20:11:13,312 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57945jbpm4jsf-14.jar!/META-INF/tfl-compat.taglib.xml
                      
                      20:11:13,312 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/jbpm4jsf-14.jar!/META-INF/identity.taglib.xml
                      
                      20:11:13,328 ERROR [STDERR] 22-ene-2008 20:11:13 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                      INFO: Added Library from: jar:file:/C:/jbpm/jbpm-jpdl-3.2.2/server/server/jbpm/tmp/deploy/tmp57949jbpm-console-exp.war/WEB-INF/lib/gravel-14.jar!/META-INF/gravel-simple.taglib.xml
                      


                      • 8. Re: Problem with managed beans
                        kukeltje

                        STFF

                        • 9. Re: Problem with managed beans
                          rodosa

                          I fixed the some of problems that I had and now it works! Thanks for your help kukeltje

                          • 10. Re: Problem with managed beans
                            kukeltje

                            Would be nice if you posted what the 'some problems' were. Others might learn from it.

                            • 11. Re: Problem with managed beans
                              rodosa

                              What I did was the following:

                              - My configuration listener in web.xml was wrong.
                              - I had an error in faces-config.xml. I didn't realized that I had the declaration of my managed-bean inside of the label. It must be outside of this label.
                              - I think that I had a problem with the librarys because I had repeated librarys, so I remove them.

                              • 12. Re: Problem with managed beans
                                kukeltje

                                tnx..... all not jbpm related ;-)