Bringing military-grade cybersecurity solutions to the enterprise and critical systems.
Telephone: 310.356.7869

Category: ExceptionOfTheDay

2:23 AM, Mon, Apr 14 2008

Today's Exception of the Day(tm) looks like this:

09:07:43,244 ERROR [ExceptionFilter] handling uncaught exception
javax.servlet.ServletException: Could not instantiate Seam component: testBean
        at javax.faces.webapp.FacesServlet.service(
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: testBean
        at org.jboss.seam.Component.newInstance(
        at org.jboss.seam.Component.getInstance(
Caused by: javax.naming.NameNotFoundException: myproject not bound
        at org.jnp.server.NamingServer.getBinding(
        at org.jnp.server.NamingServer.getBinding(
        at org.jnp.server.NamingServer.getObject(

The bean in question is a trivial stateless session bean.

What's going on here? Finding this one is maddening because it gives so little information about the possible causes or where to look. Making this one even worse, you might think the error is in some XML file. It isn't entirely. What's happening is the init line of components.xml must match the directory name of the EAR directory. For example, if your application is called pizzeria.ear, then your components.xml must look like:

<core:init debug="true" jndi-pattern="pizzeria/#{ejbName}/local"/> 

Note that the first part of the jndi-pattern must match the EAR file or directory name. The exception thrown does nothing to elucidate that.

We would recommend that the Seam team change the exception in this case to provide more information.