1
我部署了我的EJB應用程序在WebSphere 8.5.0.0服務器,但在啓動它,我現在面臨的異常以下:如何在websphere8.5.0.0中獲取UserTransaction?
**CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "getABCMethod" on bean "BeanId(ABC-ear#ABC-ejb-3.9.jar#ABC, null)". Exception data: org.hibernate.TransactionException: Could not find UserTransaction in JNDI [java:comp/UserTransaction]**
at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:173)
at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:149)
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:213)
at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:103)
at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:256)
at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:670)
at org.hibernate.context.JTASessionContext.buildOrObtainSession(JTASessionContext.java:152)
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:111)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:687)
**Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".**
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1228)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1141)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookupExt(UrlContextImpl.java:1436)
at com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:477)
at com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:485)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:370)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:163)
... 39 more
我已經嘗試了各種解決方案可作爲改變JNDI名稱爲「JTA/UserTransaction的」,「 UserTransaction「和」java:comp/UserTransaction「,但它們都不起作用。 它是webpshere-hibernate兼容性問題還是websphere 8.5.0.0具體? 請建議可能的解決方案。提前致謝。
感謝您的回覆薩比爾。但查找是正確的,我檢查。如果我將TransactionFactory從'JTATransactionFactory'更改爲'JDBCTransactionFactory',那麼它工作正常。但是我無法找到它與JTA協同工作的原因嗎? –
如何通過手動拷貝,WAS控制檯或IDE將EJB部署到服務器?如果IDE,IDE名稱? –
我正在通過WAS控制檯部署EAR文件。 –