title: Simple JSF with Managed Bean cannot be loaded by JBoss 7.1 (JBAS018210)
body: <p>I am getting a strange error in my JBoss log when i try to do a very simple JSF app via Eclipse.  So i created a simple scenario to ask, if i have missed something fundamental in my JSF example.  Alternatively, i suspect there might be a mis-configuration or bug in my particular tooling or environment.</p>
  <p>I have created a very simple JSF app.  It's just one JSF html page (hello.jsp) which collects a name via a ManagedBean and transitions to a second JSF html page (ok.jsp).  The bean has 1 getter, 1 setter, and 1 action method (addContact).</p>
  <p>I am not using annotations, just a simple faces-config.xml file with one ManagedBean entry and one navigation rule.  The bean is named &quot;contact&quot; and the class is &quot;com.mbeans.ContactBean&quot;.  I believe that the mapping is all correct.</p>
  <p>I am using JBoss 7.1 via Eclipse Juno SR2.  It's a JSF 2.0 app.  I have loaded the latest JBoss Tools 4.0 for Juno.</p>
  <p>The app only consists of the following files:</p>
  <pre><code>web.xml
  faces-config.xml
  ContactBean.java
  hello.jsp
  ok.jsp
  </code></pre>
  <p>The file contents are below.  But I'll add some colour commentary on how they were created via Eclipse (which you might want to skim or ignore):</p>
  <p>I go into Eclipse and create a new project.  I select &quot;Dynamic Web Project&quot; with the following settings:</p>
  <blockquote>
  <p>Target runtime = JBoss 7.1 Runtime</p>
  <p>Configuration = Dynamic Configuration for JBoss 7.1 Runtime</p>
  <p>Generate a web.xml = CHECKED</p>
  </blockquote>
  <p>I right-click WebContent and create a new JSP file (Filename = hello.jsp).  I use JSP Template = New JSF Page (html).</p>
  <p>I add a few lines representing a simple form accessing a ManagedBean named &quot;contact&quot; so that hello.jsp looks like this:</p>
  <pre><code>&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;
      pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib prefix=&quot;f&quot; uri=&quot;http://java.sun.com/jsf/core&quot;%&gt;
  &lt;%@ taglib prefix=&quot;h&quot; uri=&quot;http://java.sun.com/jsf/html&quot;%&gt;
  &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
  &lt;title&gt;Add Contact&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;f:view&gt;
          &lt;h2&gt;Add Contact&lt;/h2&gt;
          &lt;h:form&gt;
              Name:&lt;br&gt;
              &lt;h:inputText value=&quot;#{contact.name}&quot; /&gt;
              &lt;h:commandButton value=&quot;Add Contact&quot;
                  action=&quot;#{contact.addContact}&quot; type=&quot;submit&quot; /&gt;
          &lt;/h:form&gt;
      &lt;/f:view&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Similarly, I add the following JSP file (ok.jsp):</p>
  <pre><code>&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;
      pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib prefix=&quot;f&quot; uri=&quot;http://java.sun.com/jsf/core&quot;%&gt;
  &lt;%@ taglib prefix=&quot;h&quot; uri=&quot;http://java.sun.com/jsf/html&quot;%&gt;
  &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
  &lt;title&gt;OK - Added New Contact&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;f:view&gt;
          &lt;p&gt;
              The address for
              &lt;h:outputText value=&quot;#{contact.name}&quot; /&gt;
              was successfully added.
          &lt;/p&gt;
      &lt;/f:view&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I right-click on the project (JSFTest) and add a class with the following settings:</p>
  <blockquote>
  <p>Package = com.mbeans</p>
  <p>Name = ContactBean</p>
  </blockquote>
  <p>and I edit the class to appear like so:</p>
  <pre><code>package com.mbeans;
  
  public class ContactBean {
  
      public ContactBean() {super();}
  
      String name;
      
      public String getName() {return name;}
  
      public void setName(String name) {this.name = name;}
  
      public String addContact() {
          System.out.println(&quot;Name: &quot; + getName());
          return &quot;success&quot;;
      }  
  }
  </code></pre>
  <p>Then I right-clicked the WEB-INF folder and selected <code>New-&gt;Other-&gt;JBoss Tools Web-&gt;JSF-&gt;Faces Config</code> with the following settings:</p>
  <blockquote>
  <p>Folder:* = /JSFTest</p>
  <p>Name:* = faces-config</p>
  <p>Version: 2.0</p>
  <p>Register in web.xml = CHECKED</p>
  </blockquote>
  <p>In the new faces-config.xml that is created, I right-click <code>Managed Beans-&gt;New-&gt;Managed Bean...</code> and set the following:</p>
  <blockquote>
  <p>Scope = application</p>
  <p>Class:* = com.mbeans.ContactBean</p>
  <p>Name:* = contactBean</p>
  </blockquote>
  <p>Then I right-clicked <code>Navigation Rules-&gt;New-&gt;Rule ...</code> and left the dialog box blank and clicked <code>Finish</code>.</p>
  <p>I right-clicked <code>&quot;[any]&quot;-&gt;New-&gt;Case...</code> and set the following:</p>
  <blockquote>
  <p>From Outcome: = success</p>
  <p>From Action: = #{contact.addContact}</p>
  <p>ToView ID:* = /ok.jsp</p>
  </blockquote>
  <p>this, finally, yields the following faces-config.xml file in the WEB-INF folder:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;faces-config version=&quot;2.0&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
   xmlns:xi=&quot;http://www.w3.org/2001/XInclude&quot;
   xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd&quot;&gt;
   &lt;managed-bean&gt;
    &lt;managed-bean-name&gt;contact&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;com.mbeans.ContactBean&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;application&lt;/managed-bean-scope&gt;
   &lt;/managed-bean&gt;
   &lt;navigation-rule&gt;
    &lt;navigation-case&gt;
     &lt;from-action&gt;#{contact.addContact}&lt;/from-action&gt;
     &lt;from-outcome&gt;success&lt;/from-outcome&gt;
     &lt;to-view-id&gt;/ok.jsp&lt;/to-view-id&gt;
    &lt;/navigation-case&gt;
   &lt;/navigation-rule&gt;
  &lt;/faces-config&gt;
  </code></pre>
  <p>Then I right-clicked the hello.jsp and selected <code>Run As-&gt;Run On Server</code></p>
  <p>I selected the JBoss 7.1 Runtime Server (it's the only one).  The server starts successfully.  (I know this JBoss server correctly runs other stuff outside of Eclipse.)</p>
  <p>I get a 500 error and in particular, I see the following message in the log which I think is the root of the problem:</p>
  <pre><code>23:33:08,612 ERROR [org.jboss.web] (MSC service thread 1-3) JBAS018211: Could not load JSF managed bean class: com.mbeans.ContactBean
  </code></pre>
  <p>I think the NullPointerException may be caused by something else which I did wrong unrelated to that error message above. I am most concerned about the above error.  But if anyone can point out my mistake which clears this NullPointerException, I would appreciate it so that I can eliminate it.  Previously I got a different 500 error without the NPE but still had that JBAS018211 in the log.  In other words, I think the NPE is annoying but irrelevant.</p>
  <p>The full log is:</p>
  <pre><code>23:33:06,543 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
  23:33:06,761 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
  23:33:06,824 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final &quot;Brontes&quot; starting
  23:33:07,636 INFO  [org.xnio] XNIO Version 3.0.3.GA
  23:33:07,638 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
  23:33:07,647 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
  23:33:07,655 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
  23:33:07,678 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
  23:33:07,686 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
  23:33:07,689 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
  23:33:07,717 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
  23:33:07,725 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
  23:33:07,749 INFO  [org.jboss.as.security] (MSC service thread 1-10) JBAS013100: Current PicketBox version=4.0.7.Final
  23:33:07,749 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
  23:33:07,752 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
  23:33:07,789 INFO  [org.jboss.as.connector] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
  23:33:07,797 INFO  [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
  23:33:07,825 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-12) JBAS015400: Bound mail session [java:jboss/mail/Default]
  23:33:07,844 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
  23:33:07,971 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-7) JBoss Web Services - Stack CXF Server 4.0.2.GA
  23:33:07,982 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on http--127.0.0.1-7070
  23:33:08,341 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
  23:33:08,352 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /usr/local/jboss-as-7.1.1.Final/standalone/deployments
  23:33:08,358 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found JSFTest.war in deployment directory. To trigger deployment create a file called JSFTest.war.dodeploy
  23:33:08,360 INFO  [org.jboss.as.remoting] (MSC service thread 1-10) JBAS017100: Listening on /127.0.0.1:9999
  23:33:08,362 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /127.0.0.1:4447
  23:33:08,475 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of &quot;JSFTest.war&quot;
  23:33:08,612 ERROR [org.jboss.web] (MSC service thread 1-3) JBAS018211: Could not load JSF managed bean class: com.mbeans.ContactBean
  23:33:08,792 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-10) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/JSFTest'
  23:33:09,663 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-10) Hibernate Validator 4.2.0.Final
  23:33:09,805 INFO  [org.jboss.web] (MSC service thread 1-10) JBAS018210: Registering web context: /JSFTest
  23:33:09,818 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin console listening on http://127.0.0.1:9990
  23:33:09,819 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015874: JBoss AS 7.1.1.Final &quot;Brontes&quot; started in 3541ms - Started 172 of 249 services (76 services are passive or on-demand)
  23:33:09,873 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed &quot;JSFTest.war&quot;
  23:33:29,683 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/JSFTest].[jsp]] (http--127.0.0.1-7070-1) Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException
      at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1858) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at org.apache.jsp.hello_jsp._jspx_meth_f_005fview_005f0(hello_jsp.java:103)
      at org.apache.jsp.hello_jsp._jspService(hello_jsp.java:78)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
      at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
  </code></pre>
  <p>That's it.  That's the problem.</p>
  <p>(as an aside, Eclipse also does not display the hover-over tag descriptions for JSF.  HTML tags are OK. This makes me wonder if there's some deeper JBoss Tools misconfiguration.)</p>
  <p>Thank you for any time spent reviewing my problem.</p>