I am using JPA with Hibernate implementation and EJB 2.1 in my project (a Spring + Hibernate project). After I deployed my project to JBoss 6.0 CR1 the server log said:
15:34:20,866 INFO [EjbDeployer] installing bean: ejb/ejbproject.jar#EBMyBean,uid27484928
15:34:20,867 INFO [EjbDeployer] with dependencies:
15:34:20,870 INFO [EjbDeployer] and supplies:
15:34:20,871 INFO [EjbDeployer] jndi:EBMyBean
15:34:20,873 INFO [EjbDeployer] jndi:local/EBMyBean@31242541
15:34:21,038 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=myproject.ear/ejbproject.jar#persistenceUnit
15:34:21,196 INFO [Version] Hibernate Commons Annotations 3.2.0.Final
The server didn't start properly and at the end it threw an exception saying:
Caused by: javax.naming.NameNotFoundException: EBMyBean not bound
In JMX console of JBoss I cannot see anything under Ejb 2.1 Module section. My EAR file contains a jar file and a war file. All ejbs and persistence unit are in the jar file.
In META-INF folder of my jar file there are ejb-jar.xml and persistence.xml files but I don't have jboss.xml specified. I have a beanRefContext.xml outside that folder, as well as some bean definition files.
ejb-jar.xml is like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
'-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'
'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<!--========================================-->
<!-- EBMyBean -->
<!--========================================-->
<entity>
<description></description>
<ejb-name>EBMyBean</ejb-name>
<local-home>com.ejb.EBMyBeanHome</local-home>
<local>com.ejb.EBMyBean</local>
<ejb-class>com.ejb.EBMyBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
</entity>
<enterprise-beans>
</ejb-jar>
I also made a test project of a simple EJB 2.1 session bean without Hibernate and deployed it. The server log, however, is different:
15:30:46,658 INFO [EjbDeployer] installing bean: ejb/#HiEJB,uid14009391
15:30:46,658 INFO [EjbDeployer] with dependencies:
15:30:46,659 INFO [EjbDeployer] and supplies:
15:30:46,660 INFO [EjbDeployer] jndi:HiEJB
15:30:46,660 INFO [EjbDeployer] jndi:HiEJB/com.test.HiRemote
15:30:46,697 INFO [EjbModule] Deploying HiEJB
15:30:46,904 INFO [ProxyFactory] Bound EJB Home 'HiEJB' to jndi 'HiEJB'
In JMX console I can see some jndi objects under Ejb 2.1 Module section and the server starts OK.
It seems the beans in my first project haven't bound to jndi objects. But how can I fix this?