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(FacesServlet.java:256)
......
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: testBean
        at org.jboss.seam.Component.newInstance(Component.java:1970)
        at org.jboss.seam.Component.getInstance(Component.java:1873)
.......
Caused by: javax.naming.NameNotFoundException: myproject not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                

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.