Featured post
hibernate - Entity bean not bound when use both EJB 2 and JPA -
i using jpa hibernate implementation , ejb 2.1 in project (a spring + hibernate project). after deployed project jboss 6.0 cr1 server log said:
15:34:20,866 info [ejbdeployer] installing bean: ejb/ejbproject.jar#ebmybean,uid27484928 15:34:20,867 info [ejbdeployer] dependencies: 15:34:20,870 info [ejbdeployer] , 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 , @ end threw exception saying:
caused by: javax.naming.namenotfoundexception: ebmybean not bound
in jmx console of jboss cannot see under ejb 2.1 module section. ear file contains jar file , war file. ejbs , persistence unit in jar file.
in meta-inf folder of jar file there ejb-jar.xml , persistence.xml files don't have jboss.xml specified. have beanrefcontext.xml outside folder, bean definition files.
ejb-jar.xml 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 made test project of simple ejb 2.1 session bean without hibernate , deployed it. server log, however, different:
15:30:46,658 info [ejbdeployer] installing bean: ejb/#hiejb,uid14009391 15:30:46,658 info [ejbdeployer] dependencies: 15:30:46,659 info [ejbdeployer] , 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' jndi 'hiejb'
in jmx console can see jndi objects under ejb 2.1 module section , server starts ok.
it seems beans in first project haven't bound jndi objects. how can fix this?
i answer own question.
clearly entity beans not bound jndi objects. reason name provided default not inserted jndi pools. in case local/ebmybean@31242541. if specify local-jndi-name property in jboss.xml file able insert object jndi pool.
i use this:
<!doctype jboss public "-//jboss//dtd jboss 4.0//en" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd"> <jboss> <enterprise-beans> <entity> <ejb-name>ebmybean</ejb-name> <local-jndi-name>ejb/ebmybean</local-jndi-name> </entity> </enterprise-beans> </jboss>
then jndi name ejb/ebmybean , able find in jmx-console. tested in jboss 6.0 final.
- Get link
- X
- Other Apps
Comments
Post a Comment