Hi, I am using JBOSS 4.0.4.GA. My persistence.xml file looks like this:
<persistence>
| <persistence-unit name="org.bf.persistence">
| <jta-data-source>java:/org.bf.DS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto"
| value="update"/>
| <property name="hibernate.dialect"
| value="org.hibernate.dialect.OracleDialect"/>
| <property name="hibernate.jdbc.batch_size"
value="0"/>
| </properties>
| </persistence-unit>
| </persistence>
So my persistence context is dependend on datasource org.bf.DS declared in oracle-ds.xml.
When I redeploy the oracle-ds.xml file while jboss is running, first all datasources are
unbinded, then persistence unit tries to start (and I get NameNotFoundException: org.bf.DS
not bound) and after that ConnectionManager for org.bf.DS is bound.
So I changed the persistence.xml as follows to explicitly declare DS dependency:
<persistence>
| <persistence-unit name="org.bf.persistence">
| <jta-data-source>java:/org.bf.DS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto"
| value="update"/>
| <property name="hibernate.dialect"
| value="org.hibernate.dialect.OracleDialect"/>
| <property name="hibernate.jdbc.batch_size"
value="0"/>
| <property name="jboss.depends.DS"
value="jboss.jdbc:service=metadata,datasource=org.bf.DS"/>
| </properties>
| </persistence-unit>
| </persistence>
Now when redeploying oracle-ds.xml the persistence unit is starting after
ConnectionManager is rebounded, but I am getting :
18:13:44,825 WARN [ServiceController] Problem starting service
jboss.j2ee:ear=bf.ear,jar=bf.jar,nam
| e=CategoryDAOBean,service=EJB3
| javax.naming.NamingException: Could not bind user transaction for ejb name
CategoryDAOBean into JNDI
| under jndiName: /UserTransaction [Root exception is
javax.naming.NameAlreadyBoundException]
All entities seems to be correctly redeployed but problem is with my stateless DAO beans
dependend on persistence context.
Is there any way to enable correct redeployment of datasource configuration file declaring
datasources used by persistence units???
After 2 hours of "research" I workarounded this problem by declaring datasources
used by persistence units in separate datasource configuration files:-).
But just for the interest, is there any other solution???
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982731#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...