# JSF kann Bean nicht finden!



## Noisebub (2. Aug 2008)

Hallo!
Ich habe hier gerade ein Problem und finde die Lösung dazu absolut nicht... ich hoffe ihr könnt mir helfen...
Folgendes Problem:
Ich will in meinem JSF Felder einlesen. Habe das Bean dazu und alles erstellt.
Wenn ich nun versuche das Projekt zu starten bekomme ich folgenden Fehler:


```
executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1e2366) threw exception
javax.faces.FacesException: javax.el.PropertyNotFoundException: The class 'de.tutorial.server.model.backing.BackingBeanFacade' does not have the property 'tUserBean'.
        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 com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:279)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
        at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:276)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:276)
        at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117)
        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.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
        at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
        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.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: javax.el.PropertyNotFoundException: The class 'de.tutorial.server.model.backing.BackingBeanFacade' does not have the property 'tUserBean'.
        at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547)
        at javax.el.BeanELResolver.getValue(BeanELResolver.java:249)
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
        at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
        at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
        at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
        ... 58 more
StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
javax.el.PropertyNotFoundException: The class 'de.tutorial.server.model.backing.BackingBeanFacade' does not have the property 'tUserBean'.
        at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547)
        at javax.el.BeanELResolver.getValue(BeanELResolver.java:249)
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
        at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
        at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
        at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
        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 com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:279)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
        at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:276)
        at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271)
        at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:276)
        at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117)
        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.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
        at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
        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.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
```

Meine JSF schaut so aus:

```
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="tut" uri="http://www.foobar.de/demo/base"%>

<f:view>
  <h:panelGroup>
    <f:loadBundle basename="localization" var="loc"/>

    <tut:page title="#{loc.label_page_index_title}" css="/resources/stylesheets/styles.css">
      <h:inputHidden value="#{facade.currentSessionBean.startSessionBean}"/>

      <h:panelGrid columns="1">
        <h:column>
          <h:form>

            <h:panelGrid columns="2">
              <h:outputText value="#{loc.label_page_index_register_login}" escape="false"/>
              <h:inputText value="#{facade.tUserBean.login}"/>
              <h:outputText value="#{loc.label_page_index_register_email}" escape="false"/>
              <h:inputText value="#{facade.tUserBean.email}"/>
              <h:outputText value="#{loc.label_page_index_register_password}" escape="false"/>
              <h:inputSecret value="#{facade.tUserBean.password}"/>
              <h:outputText value="#{loc.label_page_index_register_passwordCheck}" escape="false"/>
              <h:inputSecret value="#{facade.tUserBean.passwordCheck}"/>
            </h:panelGrid>
            <h:panelGrid columns="1">
              <h:commandButton action="#{facade.tUserBean.saveRegistration}">
                <h:outputText value="#{loc.button_page_index_registration}"/>
              </h:commandButton>
            </h:panelGrid>

          </h:form>
        </h:column>
      </h:panelGrid>
    </tut:page>
  </h:panelGroup>
</f:view>
```

und meine "BackingBeanFacade" klasse, über die das Bean ja geholt werden soll so:


```
public class BackingBeanFacade {

    private TUserBean tUserBean;
    private NavigationBean navigationBean;

    public TUserBean getTUserBean() {
        if (tUserBean == null) {
            tUserBean = new TUserBean(this);
        }
        return tUserBean;
    }

    public NavigationBean getNavigationBean() {
        if (navigationBean == null) {
            navigationBean = new NavigationBean(this);
        }
        return navigationBean;
    }

    public SessionBean getCurrentSessionBean() {
        SessionBean ret = ServletHelper.getSessionBean(FacesContext.getCurrentInstance());
        if (ret == null) {
            throw new NullPointerException("The SessionBean was null.");
        }
        return ret;
    }
}
```
habt ihr eine ahnung woran das liegen könnte?
(warscheinlich ist es nur ein extrem dummer fehler den ich im moment nur übersehe)
vielen dank schonmal!


----------



## Noisebub (2. Aug 2008)

was ich noch dazu sagen sollte: in der faces-config.xml steht mein backingbeanfacade auch richtig drinnen


```
<managed-bean>
	<description>link to the backing bean facade</description>
	<managed-bean-name>facade</managed-bean-name>
	<managed-bean-class>de.tutorial.server.model.backing.BackingBeanFacade</managed-bean-class>
	<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
```

und Netbeans findet in dem JSF das Bean auch (mit vervollständigen STRG+LEER). Deswegen kann ich mir den Fehler im Moment auch nicht erklären...


----------



## Guest (2. Aug 2008)

Ich kenne mich mit JSF zwar nicht aus aber die Fehlermeldung ist für mich eindeutig


```
The class 'de.tutorial.server.model.backing.BackingBeanFacade' does not have the property 'tUserBean'
```


----------



## Noisebub (2. Aug 2008)

Dass er Probleme hat das tUserBean zu finden ist mir schon klar. Ich weiß nur nicht warum er diese Probleme hat...
Ist ja soweit alles richtig(meiner Meinung nach) und NB "findet" das Bean ja auch.


----------



## SnooP (2. Aug 2008)

Guck mal ob die betreffenden Beans einen Standard-Konstruktor haben... das ist bei solchen Sachen manchmal die Tücke 

die navigation Bean wird gefunden?


----------



## Noisebub (2. Aug 2008)

das sessionbean (ich starte ja eine neue session bei seitenaufruf) wird gefunden. im debugger läuft da alles nach plan ab. nur nach start der session "verliere" ich den debugger... da kommt dann die fehlermeldung...


----------



## maki (3. Aug 2008)

tUserBean ist ein sehr schlechter Name, halte dich an den Standard, lieber defensiver wie zB UserBean,  getUserBean, setUserBean wären  die richtigen Methoden.


----------



## Guest (3. Aug 2008)

oder verwende TUserBean statt tUserBean. Der erste Buchstabe wird bei Properties ist ein Großbuchstabe. Immer einfach das get abschneiden.


----------

