I'm a Chinese senior student, so my English is poor.
Plese forgive me for my English problems.
I'm just a newbie to Hibernate, please help me.
ForumHome is the DAO generated by Hibernate Tools
the findById method is just as below.
...
Forum instance = (Forum) sessionFactory.getCurrentSession().get("net.xarock.kdc.forum.entity.Forum", id);
...
Hibernate version:
3.1.2
Hibernate settings:
...
<property name="hibernate.current_session_context_class">
jta
</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">
True
</property>
<property name="hibernate.use_outer_join">
True
</property>
<property name="hibernate.transaction.manager_lookup_class">
JBossTransactionManagerLookup
</property>
<property name="hibernate.transaction.factory_class">
JTATransactionFactory
</property>
<property name="jta.UserTransaction">
UserTransaction
</property>
...
Codes:
Code:
//To register SessionFactory to JNDI
Configuration c=new Configuration().configure();
org.hibernate.SessionFactory sf=c.buildSessionFactory();
org.hibernate.Session s=sf.openSession();
Forum f1=null;
//The codes below is the actual codes
UserTransaction ut=(UserTransaction)new InitialContext().lookup("UserTransaction");
ut.begin();
f1=new ForumHome().findById(new Integer(1));
ut.commit();
Error:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: TransactionFactory class not found: JTATransactionFactory
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
root cause
org.hibernate.HibernateException: TransactionFactory class not found: JTATransactionFactory
org.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:41)
org.hibernate.cfg.SettingsFactory.createTransactionFactory(SettingsFactory.java:370)
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:120)
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
org.apache.jsp.test1_jsp._jspService(org.apache.jsp.test1_jsp:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.