title: Unable to create managed bean DBUserMBean. The following problems were found: - Bean or property class (...) cannot be found
body: <p>I am trying to make a Java, and JSF project with a MySQL database using Hibernate and PrimeFaces.</p>
  
  <p>Hibernate layer works good(basic CRUD works fine), but after I make basic GUI with Prime Faces and deploy project into Tomcat, server, it returns an error: </p>
  
  <pre><code>Unable to create managed bean DBUserMBean. The following problems were 
  found: - Bean or property class 
  com/hibernate/maven/Hibernate_APP/DBUserManagedBean for managed bean 
  DBUserMBean cannot be found.
  </code></pre>
  
  <p>Here are all the files in my project:</p>
  
  <p><strong>DBUser</strong></p>
  
  <pre><code>@Entity
  public final class DBUser{
      private Long  id;
      private String kolumna1;
      private String kolumna2;
      private String kolumna3;
      private int  kolumna4;
  
      @Id
      @GeneratedValue
      public Long getId() {
          return id;
      }
      public void setId(Long id) {
          this.id = id;
      }
  
      @Override
      public String toString() {
          StringBuffer strBuff = new StringBuffer();
          strBuff.append("id :").append(id);
          strBuff.append("kolumna1 :").append(kolumna1);
          strBuff.append("kolumna2 :").append(kolumna2);
          strBuff.append("kolumna3 :").append(kolumna3);
          strBuff.append("kolumna4 :").append(kolumna4);
          return strBuff.toString();
      }
  }
  </code></pre>
  
  <p><strong>DBUserManagedBean</strong></p>
  
  <pre><code>@ManagedBean(name="DBUserManagedBean")
  @SessionScoped
  public class DBUserManagedBean implements Serializable{
  
      private static final long serialVersionUID = 1L;
      private static Logger log = Logger.getLogger(DBUserManagedBean.class);
      private static final String SUCCESS = "success";
      private static final String ERROR   = "error";
  
      private Long  id;
      private String kolumna1;
      private String kolumna2;
      private String kolumna3;
      private int  kolumna4;
  
      private String message;
  
      //getters and setters   
  
      public String getMessage() {
          StringBuffer strBuff = new StringBuffer();
          strBuff.append("id :").append(id);
          strBuff.append("kolumna1 :").append(kolumna1);
          strBuff.append("kolumna2 :").append(kolumna2);
          strBuff.append("kolumna3 :").append(kolumna3);
          strBuff.append("kolumna4 :").append(kolumna4);
          this.setMessage(strBuff.toString());
          return this.message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      } 
  
      public String save() {
          String result = null;
          Session session = HibernateUtil.getSessionFactory().openSession();
  
          DBUser dbuser = new DBUser();
  
          dbuser.setKolumna1(this.getKolumna1());
          dbuser.setKolumna2(this.getKolumna2());
          dbuser.setKolumna3(this.getKolumna3());
          dbuser.setKolumna4(this.getKolumna4());
  
          Transaction tx = null;
  
          try {
              tx = session.beginTransaction();
              session.save(dbuser);
              tx.commit();
              log.debug("New Record : " + dbuser + ", wasCommitted : " + tx.wasCommitted());
              result = SUCCESS;
          } catch (Exception e) {
              if (tx != null) {
                  tx.rollback();
                  result = ERROR;
                  e.printStackTrace();
              }
          } finally {
              session.close();
      }
      return result;
  }
  
  public List&lt;DBUser&gt; getDBUsers() {
      Session session = HibernateUtil.getSessionFactory().openSession();
      List&lt;DBUser&gt;  dbuserList = session.createCriteria(DBUser.class).list();
      return dbuserList;
  }
  
  public void reset() {
      this.setKolumna1("");
      this.setKolumna2("");
      this.setKolumna3("");
      this.setKolumna4(kolumna4);
  }
  
  }
  </code></pre>
  
  <p><strong>faces-config.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;faces-config
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  
  http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
  
  version="2.0"&gt;
  
  &lt;managed-bean&gt;
  
      &lt;managed-bean-name&gt;DBUserMBean&lt;/managed-bean-name&gt;
      &lt;managed-bean-class&gt;com.hibernate.maven.Hibernate_APP.DBUserManagedBean&lt;/managed-   
  bean-class&gt;
      &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
  
  &lt;/managed-bean&gt;
  
  
  &lt;navigation-rule&gt;
      &lt;from-view-id&gt;pages/index.xhtml&lt;/from-view-id&gt;
      &lt;navigation-case&gt;
          &lt;from-outcome&gt;success&lt;/from-outcome&gt;
          &lt;to-view-id&gt;pages/welcome.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
      &lt;navigation-case&gt;
          &lt;from-outcome&gt;error&lt;/from-outcome&gt;
          &lt;to-view-id&gt;pages/error.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
  &lt;/navigation-rule&gt;
  
  &lt;/faces-config&gt;
  </code></pre>
  
  <p><strong>index.xhtml</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"  
  xmlns:h="http://java.sun.com/jsf/html"  
  xmlns:f="http://java.sun.com/jsf/core"  
  xmlns:p="http://primefaces.org/ui"&gt;  
  
  &lt;h:head&gt;&lt;title&gt;Hibernate_APP&lt;/title&gt;&lt;/h:head&gt;
  &lt;body&gt;
   &lt;h:form&gt;
  
  
       &lt;table&gt;
           &lt;tr&gt;
              &lt;td&gt;&lt;h:outputLabel for="kolumna1" value="kolumna1 :" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;p:inputText id="kolumna1" value="#{DBUserManagedBean.kolumna1}"/&gt;&lt;/td&gt;
           &lt;/tr&gt;
  
            &lt;tr&gt;
              &lt;td&gt;&lt;h:outputLabel for="kolumna2" value="kolumna2 :" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;p:inputText id="kolumna2" value="#{DBUserManagedBean.kolumna2}"/&gt;&lt;/td&gt;
           &lt;/tr&gt;
  
            &lt;tr&gt;
              &lt;td&gt;&lt;h:outputLabel for="kolumna3" value="kolumna3 :" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;p:inputText id="kolumna3" value="#{DBUserManagedBean.kolumna3}"/&gt;&lt;/td&gt;
           &lt;/tr&gt;
  
            &lt;tr&gt;
              &lt;td&gt;&lt;h:outputLabel for="kolumna4" value="kolumna4 :" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;p:inputText id="kolumna4" value="#{DBUserManagedBean.kolumna4}"/&gt;&lt;/td&gt;
           &lt;/tr&gt;
  
  
  
           &lt;tr&gt;
              &lt;td&gt;&lt;p:commandButton id="submit" value="Save" action="#   
  {DBUserManagedBean.save}" ajax="false"/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;p:commandButton id="reset" value="Reset" action="#   
  {DBUserManagedBean.reset}" ajax="false"/&gt;&lt;/td&gt;
  
           &lt;/tr&gt;
       &lt;/table&gt;
  
  
   &lt;/h:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>welcome.xhtml</strong></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.prime.com.tr/ui"&gt;
  
  &lt;h:head&gt;
  &lt;title&gt;Hibernate_APP&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;body&gt;
  &lt;h:form&gt;
      &lt;h:outputText value="Saved Record is #{DBUserMBean.message}"&gt;&lt;/h:outputText&gt;
      &lt;p:dataTable id="DBUsers" value="#{DBUserMBean.getDBUsers()}" var="DBUser"    
  style="width: 10%"&gt;
  
  
          &lt;p:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="ID" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{DBUser.id}" /&gt;
          &lt;/p:column&gt;
  
         &lt;p:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="kolumna1" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{DBUser.kolumna1}" /&gt;
          &lt;/p:column&gt;
  
          &lt;p:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="kolumna2" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{DBUser.kolumna2}" /&gt;
          &lt;/p:column&gt;
  
            &lt;p:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="kolumna3" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{DBUser.kolumna3}" /&gt;
          &lt;/p:column&gt;
  
  
            &lt;p:column&gt;
              &lt;f:facet name="header"&gt;
                  &lt;h:outputText value="kolumna4" /&gt;
              &lt;/f:facet&gt;
              &lt;h:outputText value="#{DBUser.kolumna4}" /&gt;
          &lt;/p:column&gt;
  
  
  
  
      &lt;/p:dataTable&gt;
    &lt;/h:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the exception when I try to save something to database trough my form:</p>
  
  <pre><code>WARNING: /pages/index.xhtml @14,87 value="#{DBUserManagedBean.kolumna1}": 
  Target Unreachable, identifier 'DBUserManagedBean' resolved to null
  javax.el.PropertyNotFoundException: /pages/index.xhtml @14,87 
  value="#{DBUserManagedBean.kolumna1}": Target Unreachable, 
  identifier 'DBUserManagedBean' resolved to null
  </code></pre>