Websphere 8.5和Hibernate 3.2.7用户TransactionManager错误

时间:2015-07-21 10:05:39

标签: hibernate websphere

我们有一个非常古老的应用程序,它使用Hibernate 3.1.3。我们正在升级到Hibernate 3.2.7(我知道它的旧版本的hibernate,最终我们计划转移到4.x)。 我得到了这个例外。我们正在使用我们的自定义" manager_lookup_class"调用Transactionmanagerfactory来获取事务管理器

    used by: org.hibernate.TransactionException: Could not find UserTransaction in JNDI [java:comp/UserTransaction]
at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:148)
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:172)
at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:76)
at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:214)
at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:574)
at org.hibernate.context.JTASessionContext.buildOrObtainSession(JTASessionContext.java:114)
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:80)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:591)
at com.dataaccess.utility.hibernate.impl.SessionManagerImpl.getSession(SessionManagerImpl.java:319)
at com.dataaccess.handler.hibernate.impl.HandlerAdapter.getSession(HandlerAdapter.java:83)
at com.dataaccess.handler.hibernate.impl.BatchProcessingHandlerImpl.flush(BatchProcessingHandlerImpl.java:344)
at com.dataaccess.handler.hibernate.impl.BatchProcessingHandlerImpl.batchDelete(BatchProcessingHandlerImpl.java:406)
... 34 more


   Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1229)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1142)
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 org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:162)
... 46 more

1 个答案:

答案 0 :(得分:0)

我认为这个例外不言自明:

Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".

您正在执行jndi查找,并且资源不存在,至少不在该名称下。仔细检查您的配置,确保您正在寻找的任何内容都以您正在使用的名称在jndi上下文中注册。