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.  [ 5 posts ] 
Author Message
 Post subject: "No TransactionManagerLookup specified" exception
PostPosted: Tue May 10, 2005 4:48 am 
Newbie

Joined: Thu Sep 16, 2004 6:03 am
Posts: 15
Location: Moscow, Russia
Hibernate version:3

Name and version of the database you are using: Postgress 7(Hosting), 8 (at home)

Here is the hibernate.properties:

Code:
hibernate.show_sql=false
hibernate.use_outer_join=true

hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class=org.postgresql.Driver

hibernate.connection.url=jdbc:postgresql://localhost/myDB
hibernate.connection.username=user
hibernate.connection.password=password

hibernate.connection.SelectMethod=cursor
hibernate.cglib.use_reflection_optimizer=false
hibernate.connection.pool_size=20


Here is code next
Code:
package ru.gubber.test.actions;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.hibernate.classic.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.Properties;

public class TestAction extends Action{

    public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm,
           javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse
            httpServletResponse) throws Exception {

        try {
            Session session = getSession();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return actionMapping.findForward("success");
    }

    private Session getSession() throws IOException {
        SessionFactory result = null;

        String path = getClass().getClassLoader().getResource("hibernate.properties").getPath();
        Configuration configuration = new Configuration();
        configuration.addProperties(getProperties(path));
        path = getClass().getClassLoader().getResource("mappings/mappings.jar").getPath();
        configuration.addJar(new File(path));
        result = configuration.buildSessionFactory();

        return result.getCurrentSession();//Error throws here
    }

    private Properties getProperties(String path) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream(path));
        return properties;
    }

}


The Stacktrace
Code:
org.hibernate.HibernateException: No TransactionManagerLookup specified
   at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:496)
   at ru.gubber.test.actions.TestAction.getSession(TestAction.java:41)
   at ru.gubber.test.actions.TestAction.execute(TestAction.java:23)
   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 org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
   at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
   at com.caucho.server.http.Invocation.service(Invocation.java:315)
   at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
   at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
   at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
   at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
   at java.lang.Thread.run(Thread.java:534)


Where am I wrong? And what should I do?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 11:23 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
getCurrentSession is only available within a JTA environment. Use openSession instead.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 8:10 am 
Newbie

Joined: Thu Sep 16, 2004 6:03 am
Posts: 15
Location: Moscow, Russia
openSession creates an instance of org.hibernate.Session but I need instance of or.hibernate.classic.Session.
How can I create instance of or.hibernate.classic.Session without the Exception?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 8:11 am 
Newbie

Joined: Thu Sep 16, 2004 6:03 am
Posts: 15
Location: Moscow, Russia
openSession creates an instance of org.hibernate.Session but I need instance of or.hibernate.classic.Session.
How can I create instance of or.hibernate.classic.Session without the Exception?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 8:15 am 
Newbie

Joined: Thu Sep 16, 2004 6:03 am
Posts: 15
Location: Moscow, Russia
Sorry I'm wrong...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.