2012-07-02 52 views
0

我不能建立我的實體管理器工廠,我得到的錯誤是「選擇的事務策略需要訪問JTA事務管理器」。任何人都可以提醒我必須配置什麼才能過去?僅供參考我正在使用Jboss 6,沒有春天。無法創建EntityManager工廠bc JTA tx管理器requiered

這裏是我的persistance.xml

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
    <persistence-unit name="AvengersPU" transaction-type="JTA"> 
    <jta-data-source>java:/jdbc/thor_ds</jta-data-source> 
    <class>avenger.Grouptable</class> 
    <class>avenger.MyUser</class> 
    <exclude-unlisted-classes>true</exclude-unlisted-classes> 
    <properties> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> 
    </properties> 
    </persistence-unit> 
</persistence> 

下面是部分堆棧跟蹤...

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: AvengersPU] Unable to build EntityManagerFactory 
     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) [:3.6.6.Final] 
     at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) [:3.6.6.Final] 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) [:1.0.0.Final] 
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) [:1.0.0.Final] 
     at avenger.Utils.getEntityManager(Utils.java:49) [:] 
     at avenger.UserBean.updateUserList(UserBean.java:136) [:] 
     at avenger.UserBean.startup(UserBean.java:43) [:] 
     ... 68 more 
Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager 
     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:390) [:3.6.6.Final] 
     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872) [:3.6.6.Final] 
     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906) [:3.6.6.Final] 
     ... 74 more 

完整堆棧跟蹤是在這裏:http://pastebin.ca/2166417

回答

0

這裏是一個不理想的答案我將在此期間使用。

指定非JTA數據源:

<non-jta-data-source>java:/jdbc/thor_ds</non-jta-data-source> 

變化交易類型從JTA到RESOURCE_LOCAL

<persistence-unit name="AvengersPU" transaction-type="RESOURCE_LOCAL"> 

這裏是關於受試者的discussion

相關問題