部署hibernate時出現NameAlreadyBoundException異常,是怎麼回事??

hello kitty發表於2005-05-18
我的EAR檔案如下
-hrProject.ear
+hrHiberanteClasses.jar
+hrHibernate.sar
+hrManage.jar
+hrManageWeb.war
META-INF
hrHiberanteClasses.jar檔案中部署的是對映類
hrHibernate.sar檔案中部署的是hbm.xml檔案
執行JBOSS時出現異常javax.naming.NameAlreadyBoundException; remaining name 'env'例如其中一個是10:26:24,140 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=RoleManage,service=EJB
javax.naming.NameAlreadyBoundException; remaining name 'env',並且其他EJB也出現這樣的錯誤.請問這是真麼回是,我把持久類檔案hrHibernate.sar和META-INF/jboss-app.xml刪掉就是正常的
META-INF/jboss-app.xml內容如下:
<jboss-app>
<loader-repository>hrProject:loader=hrProject.ear</loader-repository>
<module>
<service>hrHibernate.sar</service>
</module>

</jboss-app>
META-INF/application.xml內容如下:
<application>
<display-name>MY HRProject</display-name>

<module>
<web>
<web-uri>hrManageWeb.war</web-uri>
<context-root>/hrProject</context-root>
</web>
</module>

<module>
<java>hrHiberanteClasses.jar</java>
</module>

<module>
<ejb>hrManage.jar</ejb>
</module>

</application>
hrHibernate.sar/META-INF/jboss-service.xml內容如下:
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory">
<!--<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=searchDS</depends>-->
<!-- Make it deploy ONLY after DataSource had been started -->
<!-- Map file -->
<attribute name="MapResources">
cn\com\hzh\hibernate\UserInfo.hbm.xml
cn\com\hzh\hibernate\UserInfo2.hbm.xml
cn\com\hzh\hibernate\UserRole.hbm.xml
cn\com\hzh\hibernate\UsersRoles.hbm.xml
</attribute>

<attribute name="JndiName">java:comp/env/hibernate/MySessionFactory</attribute>
<attribute name="Datasource">java:/MySql</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="UserTransactionName">java:/UserTransaction</attribute>
<!--<attribute name="hibernate.cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</attribute>-->
</mbean>
</server>

相關文章