L
Larry
I have a Struts/Hibernate application for which I run some "heartbeat"
processing, i.e. a thread which checks some things every minute. I
call java.util.Timer.scheduleAtFixedRate from my app's startup code to
set up this heartbeat thread. When I try to call the
org.hibernate.Transaction.beginTransaction() method inside the
heartbeat thread I get the error below, which indicates that Hibernate
is not able to find "comp/UserTransaction" in JNDI.
However, in other places in the application (i.e. code which is
executed a web request) the beginTransaction call works fine! It
seems there must be some difference in the environment between the
heartbeat thread and the rest of the app which is causing the JNDI
problem only in the heartbeat. Any ideas?
-------------------------------
2efc2efc JTATransactio E org.hibernate.transaction.JTATransaction
TRAS0014I: The following exception was logged
javax.naming.NameNotFoundException: Name "comp/UserTransaction" not
found in context "java:".
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at javax.naming.NamingException.<init>(NamingException.java:111)
at
com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1021)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at
com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:196)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at
org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60)
at
org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53)
at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:177)
at
org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1279)
at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1289)
at com.test.heartbeat.check.run(check.java:22)
at java.util.TimerThread.mainLoop(Timer.java:446)
at java.util.TimerThread.run(Timer.java:396)
processing, i.e. a thread which checks some things every minute. I
call java.util.Timer.scheduleAtFixedRate from my app's startup code to
set up this heartbeat thread. When I try to call the
org.hibernate.Transaction.beginTransaction() method inside the
heartbeat thread I get the error below, which indicates that Hibernate
is not able to find "comp/UserTransaction" in JNDI.
However, in other places in the application (i.e. code which is
executed a web request) the beginTransaction call works fine! It
seems there must be some difference in the environment between the
heartbeat thread and the rest of the app which is causing the JNDI
problem only in the heartbeat. Any ideas?
-------------------------------
2efc2efc JTATransactio E org.hibernate.transaction.JTATransaction
TRAS0014I: The following exception was logged
javax.naming.NameNotFoundException: Name "comp/UserTransaction" not
found in context "java:".
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at javax.naming.NamingException.<init>(NamingException.java:111)
at
com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1021)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at
com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:196)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at
org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60)
at
org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53)
at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:177)
at
org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1279)
at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1289)
at com.test.heartbeat.check.run(check.java:22)
at java.util.TimerThread.mainLoop(Timer.java:446)
at java.util.TimerThread.run(Timer.java:396)