Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
None
-
None
-
None
Description
There is a problem identified with the default JNDI names for EJB2 beans – it breaks compatibility with older JBoss AS versions (say 4.0.x). I
Basically, in the past, if you deploy an EJB2 without jboss.xml, the default JNDI name would be the value of <ejb-name>. But this is no
longer the case in AS 4.2.0. The new default JNDI name for EJB2 beans is now something like: local/ chap2.EchoBean@32512809, where the number looks like a hashcode.
This problem can be fixed by adding a jboss.xml file to the EJB2 application and explicitly specify the JNDI binding.
The sample app is one documented in the Server Configuration Guide - Chapter 4.4
http://docs.jboss.com/jbossas/guides/j2eeguide/r2/jboss4-j2ee- examples.zip
"Basically the problem is due to the EJB in question being bound into the Global JNDI tree using the name local/chap2.EchoBean@32512809,
where the number looks like a hashcode.
This results in the objectName for the EJB container being
jboss.j2ee:jndiName=local/chap2.EchoBean@32512809,service=EJB.
As the EjbMBeanAdaptor service explicitly depends on an EJB Container with objectName jboss.j2ee:service=EJB,jndiName=local/chap2.EchoBean
(without the @32512809) it never starts as the dependency is not resolved so the EJB home is never cached. This explains why a NullPointerException is thrown when the echo() method is called."
To reproduce, once the above is unzipped.
cd examples
ant -Dchap=jmx -Dex=3 run-example
This deploys the archive.
To run the test:
go to the jmx-console
http://localhost:8080/jmx-console
find the service=EjbMBeanAdaptor in the jboss.book domain
click on the link and scroll down to the echo operation section
enter the ParamValue -echo-arg
and hit invoke
NPE thrown:
2007-05-18 17:56:20,204 INFO [org.jboss.book.jmx.ex3.EjbMBeanAdaptor] Begin invoke, actionName=echo
2007-05-18 17:56:20,204 INFO [org.jboss.book.jmx.ex3.EjbMBeanAdaptor] Lookup EchoLocalHome@local/chap2.EchoBean
2007-05-18 17:56:20,205 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jmx-console].[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception
java.lang.NullPointerException
at org.jboss.book.jmx.ex3.EjbMBeanAdaptor.echo(EjbMBeanAdaptor.java:131)
at org.jboss.book.jmx.ex3.EjbMBeanAdaptor.invoke(EjbMBeanAdaptor.java:284)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
A requiremenht of the JBEAP PRD:
Customers who have deployed JBoss AS 4.0.x should be able to migrate their applications to the application platform. This means they should be able to deploy existing WARs and EARs that worked on JBoss 4.0.x to the application platform.