-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: OC4J CMT TransactionManagerLookup problem
PostPosted: Tue Aug 16, 2005 11:23 am 
Newbie

Joined: Fri Aug 13, 2004 12:06 pm
Posts: 15
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Mapping documents:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory name="java:/hibernate/SessionFactory">

<property name="hibernate.generate_statistics">true</property>

<property name="hibernate.show_sql">false</property>

<property name="hibernate.use_sql_comments">true</property>

<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>

<property name="hibernate.default_schema">PA_DEV</property>

<property name="hibernate.order_updates">true</property>



<!-- Setup JNDI:
JDBC connections obtained from a JNDI datasource will
automatically participate in the container-managed transactions
of the application server.
-->

<!-- The datasource in JNDI -->
<property name="hibernate.connection.datasource">jdbc/pa_eGrants</property>
<property name="hibernate.connection.username">pa_dev</property>
<property name="hibernate.connection.password">pa_dev</property>

<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.CMTTransactionFactory
</property>

<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.OrionTransactionManagerLookup
</property>

<property name="hibernate.transaction.flush_before_completion">true</property>

<property name="hibernate.transaction.auto_close_session">true</property>

<property name="hibernate.connection.release_mode">auto</property>



<property name="hibernate.jdbc.batch_versioned_data">true</property>

<property name="hibernate.jdbc.use_get_generated_keys">true</property>


<!-- Second-level caching (not used now) -->
<!--
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<property name="hibernate.cache.use_query_cache">true</property>
-->


<!-- Mapping files -->
<mapping resource="META-INF/PgAmendmentRequests.hbm.xml" />
<mapping resource="META-INF/PgAppLevelPermissions.hbm.xml" />
<mapping resource="META-INF/PgApplications.hbm.xml" />
<mapping resource="META-INF/PgAwardDtl.hbm.xml" />
<mapping resource="META-INF/PgMatchSources.hbm.xml" />
<mapping resource="META-INF/PgRevisionRequestDtl.hbm.xml" />
<mapping resource="META-INF/PgRevisionRequests.hbm.xml" />
<mapping resource="META-INF/PgSections.hbm.xml" />
<mapping resource="META-INF/PgSubgrantApplications.hbm.xml" />


<!-- cache settings for mapped entities -->
<!--
<class-cache
class="gov.fema.paegrants.hibernate.PgAmendmentRequests"
usage="read-only"
/>

<collection-cache
class="gov.fema.paegrants.hibernate.AmendmentRequests"
usage="read-write"
/>
-->

</session-factory>

</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():
Session session = HibernateUtil.getCurrentSession();
// the container takes care of transactions for us
//Transaction tx = session.beginTransaction();
for (int i = 0; i < numItems; i++) {
PgAmendmentRequests amdmtReq = (PgAmendmentRequests) ((List) dto.getTableDataList()).get(i);
//PgAmendmentRequests amdmtReq = new PgAmendmentRequests();
amdmtReq.setApplicationId(amdmtReq.getApp().getApplicationId().longValue());
amdmtReq.setRequestedAmendmentType(reqAmendType.toString());

DebugLog.info("********8********* subgrantId: " + amdmtReq.getApplicationId());
//session.saveOrUpdate(amendment);
Long newId = (Long) session.save(amdmtReq);
DebugLog.info("********8********* Create new PgAmendmentRequests with Id: " + newId);

}

//tx.commit();

} catch (Exception e) {
throw new DataRetrievalException(e);
}
//finally {
// HibernateUtil.closeSession();
//}


Full stack trace of any exception that occurs:

gov.fema.paegrants.exceptions.LoggableEJBException:
nested exception is: gov.fema.paegrants.hibernate.DataRetrievalException:
org.hibernate.HibernateException: No TransactionManagerLookup specified

gov.fema.paegrants.hibernate.DataRetrievalException:
org.hibernate.HibernateException:
No TransactionManagerLookup specified

at gov.fema.paegrants.dao.HibernateDAO.storeAmendmentRequest(HibernateDAO.java:367)
at gov.fema.paegrants.ejb.GrantApplicationBean.storeAmendmentRequest(GrantApplicationBean.java:529)
at GrantApplication_StatelessSessionBeanWrapper24.storeAmendmentRequest(GrantApplication_StatelessSessionBeanWrapper24.java:7440)
at gov.fema.paegrants.grant.actions.AmendmentRequestLSAction.store(AmendmentRequestLSAction.java:59)
at gov.fema.paegrants.grant.actions.AmendmentRequestAction.execute(AmendmentRequestAction.java:116)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at gov.fema.paegrants.servlets.PAActionServlet.process(PAActionServlet.java:133)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.hibernate.HibernateException: No TransactionManagerLookup specified
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:503)
at gov.fema.paegrants.hibernate.HibernateUtil.getCurrentSession(HibernateUtil.java:47)
at gov.fema.paegrants.dao.HibernateDAO.storeAmendmentRequest(HibernateDAO.java:339)
... 18 more
gov.fema.paegrants.exceptions.LoggableEJBException: nested exception is: gov.fema.paegrants.hibernate.DataRetrievalException: org.hibernate.HibernateException: No TransactionManagerLookup specified
at gov.fema.paegrants.exceptions.ExceptionUtil.createEJBException(ExceptionUtil.java:15)
at gov.fema.paegrants.ejb.GrantApplicationBean.storeAmendmentRequest(GrantApplicationBean.java:532)
at GrantApplication_StatelessSessionBeanWrapper24.storeAmendmentRequest(GrantApplication_StatelessSessionBeanWrapper24.java:7440)
at gov.fema.paegrants.grant.actions.AmendmentRequestLSAction.store(AmendmentRequestLSAction.java:59)
at gov.fema.paegrants.grant.actions.AmendmentRequestAction.execute(AmendmentRequestAction.java:116)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at gov.fema.paegrants.servlets.PAActionServlet.process(PAActionServlet.java:133)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)

Name and version of the database you are using:

Oracle 9i, appl. server = OC4J 10.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


How do you configure Hibernate to use OC4J's CMT's? what am I doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 1:35 pm 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Try debuging your session factory creation.
See why <property name="hibernate.transaction.manager_lookup_class"> doesn't have any influence.

SessionFactoryImpl.java

Code:
      if ( settings.getTransactionManagerLookup()!=null ) {
         log.debug("obtaining JTA TransactionManager");
         transactionManager = settings.getTransactionManagerLookup().getTransactionManager(properties);
      }
      else {
         transactionManager = null;
      }

...

   public org.hibernate.classic.Session getCurrentSession() throws HibernateException {
      if ( transactionManager == null ) {
         throw new HibernateException( "No TransactionManagerLookup specified" );
      }
               


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.