-->
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: NamingException
PostPosted: Wed Apr 08, 2009 5:47 pm 
Newbie

Joined: Sun Jan 06, 2008 8:11 pm
Posts: 6
My setting is the following:

hibernate.cfg.xml

Code:
.
.
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</property>
.
.


java code

Code:
.
.
UserTransaction tx = null;
   
    try {
     
      tx = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
     
      tx.begin();
.
.



I keep getting the following stack trace;


Code:
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.isite.admin.actions.Login.exec(Login.java:88)
at com.isite.admin.actions.Action.getTemplate(Action.java:493)
at com.isite.admin.ControllerServlet.handleRequest(ControllerServlet.java:238)
at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:333)
at org.apache.velocity.servlet.VelocityServlet.doPost(VelocityServlet.java:303)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
.
.


PS: I am using 'apache-tomcat-6.0.18' and 'hibernate-distribution-3.3.1.GA'



Can anyone provide some help please?


Chris


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 08, 2009 9:09 pm 
Beginner
Beginner

Joined: Sun Dec 28, 2008 6:01 pm
Posts: 24
Did you setup or configure JNDI in Tomcat?

Also, AFAIK, I don't think with Tomcat you could use UserTransaction. You will have write your own transaction boundaries/management using hibernate's default JDBC transaction management programmatically. This article might help you http://www.theserverside.com/tt/articles/article.tss?l=HibernateTomcat

_________________
______________________________________
Please do RATE if this post was helpful


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.