-->
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.  [ 7 posts ] 
Author Message
 Post subject: sessionFactory.openSession() call failed
PostPosted: Wed Jun 01, 2005 1:23 am 
Newbie

Joined: Mon Feb 21, 2005 3:49 am
Posts: 15
Dear All

have problems to invoke sessionFactory.openSession()

I am run Tomcat Project on Debian Linux, JDK1.5.0.03, Struts 1.2.4, Hibernate 2.1.8, MySQL 4.1.11, Tomcat 5.0.28

any help are great appreciated

max

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.8
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="com.cfreecom.dating.hib2">
<class name="Cat" table="cat">
<id
column="cat_id"
name="id"
type="string"
>
<generator class="vm" />
</id>
<property
column="sex"
length="1"
name="sex"
not-null="false"
type="string"
/>
<property
column="name"
length="16"
name="name"
not-null="true"
type="string"
/>
<property
column="weight"
length="10"
name="weight"
not-null="false"
type="big_decimal"
/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

import com.cfreecom.dating.hib2.*;
import com.cfreecom.dating.hib2.dao.*;

public class CatAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

Log log = LogFactory.getLog(CatAction.class);

System.out.println("Hibernate - CatAction ...");

SessionFactory sf = null;
Session s = null;
Transaction tx = null;

try {
System.out.println("ActAction ... try ");

sf = new Configuration().configure().buildSessionFactory();
System.out.println("CatAction: "+sf.toString());
s = sf.openSession();
System.out.println("CatAction: openSession() ... "+s.toString());

tx = s.beginTransaction();
System.out.println("trans: "+tx.toString());
// do your job here ...
Cat cat = new Cat();
cat.setId("Cat1");
cat.setName("Cat1");
cat.setWeight(new java.math.BigDecimal(7.4f));

s.save(cat, s);
System.out.println("session save ");
tx.commit();
System.out.println("trans commit ");

} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
} finally {
if(s != null) {
try {
s.close();
System.out.println("session close ");
} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
}
}
}

return (mapping.getInputForward());
}

public void printCol(String str) {
System.out.print(str);
System.out.print(" | ");
}

}

Full stack trace of any exception that occurs:

Name and version of the database you are using:
MySQL 4.1.11, Jconnector 3.1.8
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hibernate - CatAction ...
ActAction ... try
13:01:14,454 INFO Environment:483 - Hibernate 2.1.8
13:01:14,455 INFO Environment:512 - hibernate.properties not found
13:01:14,457 INFO Environment:543 - using CGLIB reflection optimizer
13:01:14,458 INFO Environment:572 - using JDK 1.4 java.sql.Timestamp handling
13:01:14,461 INFO Configuration:909 - configuring from resource: /hibernate.cfg.xml
13:01:14,461 INFO Configuration:881 - Configuration resource: /hibernate.cfg.xml
13:01:14,943 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Cat.hbm.xml
13:01:15,019 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Cat -> cat
13:01:15,103 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Photo.hbm.xml
13:01:15,111 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Photo -> photo
13:01:15,326 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Role.hbm.xml
13:01:15,332 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Role -> role
13:01:15,341 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/User.hbm.xml
13:01:15,355 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.User -> user
13:01:15,358 INFO Configuration:1067 - Configured SessionFactory: null
13:01:15,359 INFO Configuration:641 - processing one-to-many association mappings
13:01:15,359 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.Role.userSet -> user
13:01:15,360 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.User.photoSet -> photo
13:01:15,361 INFO Configuration:650 - processing one-to-one association property references
13:01:15,361 INFO Configuration:675 - processing foreign key constraints
13:01:15,390 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
13:01:15,400 INFO SettingsFactory:70 - Maximim outer join fetch depth: 2
13:01:15,407 INFO SettingsFactory:74 - Use outer join fetching: true
13:01:15,412 INFO C3P0ConnectionProvider:48 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/dating
13:01:15,412 INFO C3P0ConnectionProvider:49 - Connection properties: {user=dating, password=dating}
13:01:15,447 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
13:01:15,451 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@dbbe8b [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@153e0c0 [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxIdleTime -> 900, maxPoolSize -> 5, maxStatements -> 0, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@baa573 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://localhost:3306/dating, properties -> {user=dating, password=dating} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
13:01:15,741 INFO SettingsFactory:114 - Use scrollable result sets: true
13:01:15,742 INFO SettingsFactory:117 - Use JDBC3 getGeneratedKeys(): true
13:01:15,742 INFO SettingsFactory:120 - Optimize cache for minimal puts: false
13:01:15,743 INFO SettingsFactory:126 - echoing all SQL to stdout
13:01:15,749 INFO SettingsFactory:129 - Query language substitutions: {}
13:01:15,750 INFO SettingsFactory:140 - cache provider: net.sf.hibernate.cache.EhCacheProvider
13:01:15,754 INFO Configuration:1130 - instantiating and configuring caches
13:01:15,765 WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/usr/local/jakarta-tomcat-5.0.28/work/Catalina/localhost/dating/loader/ehcache-failsafe.xml
13:01:15,967 INFO SessionFactoryImpl:119 - building session factory
13:01:16,225 WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
13:01:16,231 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
CatAction: net.sf.hibernate.impl.SessionFactoryImpl@1a6eeab


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 1:36 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

I have changed few lines

check for my comment (i.e //by ram);

Code between sessionFactory.openSession() and session.close():
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

import com.cfreecom.dating.hib2.*;
import com.cfreecom.dating.hib2.dao.*;

public class CatAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

Log log = LogFactory.getLog(CatAction.class);

System.out.println("Hibernate - CatAction ...");

//SessionFactory sf = null; //by ram
Session s = null;
//Transaction tx = null; //by ram

try {
System.out.println("ActAction ... try ");

sf = new Configuration().configure().buildSessionFactory();
System.out.println("CatAction: "+sf.toString());
s = sf.openSession();
System.out.println("CatAction: openSession() ... "+s.toString());

Transaction tx = s.beginTransaction(); //by ram
System.out.println("trans: "+tx.toString());
// do your job here ...
Cat cat = new Cat();
cat.setId("Cat1");
cat.setName("Cat1");
cat.setWeight(new java.math.BigDecimal(7.4f));

s.save(cat, s);
System.out.println("session save ");
tx.commit();
System.out.println("trans commit ");

} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
} finally {
if(s != null) {
try {
s.close();
System.out.println("session close ");
} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
}
}
}

return (mapping.getInputForward());
}

public void printCol(String str) {
System.out.print(str);
System.out.print(" | ");
}

}

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 1:38 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

I missed an change in your code

SessionFactory sf = new Configuration().configure().buildSessionFactory();

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject: sessioFactory.openSession() call fail
PostPosted: Wed Jun 01, 2005 1:51 am 
Newbie

Joined: Mon Feb 21, 2005 3:49 am
Posts: 15
ramnath wrote:
Hi

I missed an change in your code

SessionFactory sf = new Configuration().configure().buildSessionFactory();


thx Ramnath

I did change my code accordingly as follow, but same problems

//////////////////////////////////////////////////////////////

import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

import com.cfreecom.dating.hib2.*;
import com.cfreecom.dating.hib2.dao.*;

public class CatAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

Log log = LogFactory.getLog(CatAction.class);

System.out.println("Hibernate - CatAction ...");

Session session = null;

try {
System.out.println("ActAction ... try ");

SessionFactory sf = new Configuration().configure().buildSessionFactory();
session = sf.openSession();
Transaction tx = session.beginTransaction();
System.out.println("trans: "+tx.toString());
// do your job here ...
Cat cat = new Cat();
cat.setId("Cat1");
cat.setName("Cat1");
cat.setWeight(new java.math.BigDecimal(7.4f));

session.save(cat, session);
System.out.println("session save ");
tx.commit();
System.out.println("trans commit ");

} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
} finally {
if(session != null) {
try {
session.close();
System.out.println("session close ");
} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
}
}
}

return (mapping.getInputForward());
}

public void printCol(String str) {
System.out.print(str);
System.out.print(" | ");
}

}

//////////////////////////// catalina.out ///////////////////////////////////

Hibernate - CatAction ...
ActAction ... try
13:48:01,166 INFO Environment:483 - Hibernate 2.1.8
13:48:01,168 INFO Environment:512 - hibernate.properties not found
13:48:01,170 INFO Environment:543 - using CGLIB reflection optimizer
13:48:01,171 INFO Environment:572 - using JDK 1.4 java.sql.Timestamp handling
13:48:01,173 INFO Configuration:909 - configuring from resource: /hibernate.cfg.xml
13:48:01,174 INFO Configuration:881 - Configuration resource: /hibernate.cfg.xml
13:48:01,280 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Cat.hbm.xml
13:48:01,395 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Cat -> cat
13:48:01,466 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Photo.hbm.xml
13:48:01,479 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Photo -> photo
13:48:01,667 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Role.hbm.xml
13:48:01,674 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Role -> role
13:48:01,682 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/User.hbm.xml
13:48:01,703 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.User -> user
13:48:01,706 INFO Configuration:1067 - Configured SessionFactory: null
13:48:01,707 INFO Configuration:641 - processing one-to-many association mappings
13:48:01,707 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.Role.userSet -> user
13:48:01,708 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.User.photoSet -> photo
13:48:01,709 INFO Configuration:650 - processing one-to-one association property references
13:48:01,709 INFO Configuration:675 - processing foreign key constraints
13:48:01,732 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
13:48:01,742 INFO SettingsFactory:70 - Maximim outer join fetch depth: 2
13:48:01,742 INFO SettingsFactory:74 - Use outer join fetching: true
13:48:01,747 INFO C3P0ConnectionProvider:48 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/dating
13:48:01,747 INFO C3P0ConnectionProvider:49 - Connection properties: {user=dating, password=dating}
13:48:01,788 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
13:48:01,791 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@5e7663 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@12833ff [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxIdleTime -> 900, maxPoolSize -> 5, maxStatements -> 0, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1ae7b85 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://localhost/dating, properties -> {user=dating, password=dating} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
13:48:02,259 INFO SettingsFactory:114 - Use scrollable result sets: true
13:48:02,260 INFO SettingsFactory:117 - Use JDBC3 getGeneratedKeys(): true
13:48:02,260 INFO SettingsFactory:120 - Optimize cache for minimal puts: false
13:48:02,260 INFO SettingsFactory:126 - echoing all SQL to stdout
13:48:02,261 INFO SettingsFactory:129 - Query language substitutions: {}
13:48:02,261 INFO SettingsFactory:140 - cache provider: net.sf.hibernate.cache.EhCacheProvider
13:48:02,266 INFO Configuration:1130 - instantiating and configuring caches
13:48:02,277 WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/usr/local/jakarta-tomcat-5.0.28/work/Catalina/localhost/dating/loader/ehcache-failsafe.xml
13:48:02,314 INFO SessionFactoryImpl:119 - building session factory
13:48:02,524 WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
13:48:02,532 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 2:14 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
hi
Print the sf , session also
SessionFactory sf = new Configuration().configure().buildSessionFactory();
session = sf.openSession();
Transaction tx = session.beginTransaction();

Show me your hibernate.cfg.xml

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject: openSession() call failure
PostPosted: Wed Jun 01, 2005 6:24 am 
Newbie

Joined: Mon Feb 21, 2005 3:49 am
Posts: 15
ramnath wrote:
hi
Print the sf , session also
SessionFactory sf = new Configuration().configure().buildSessionFactory();
session = sf.openSession();
Transaction tx = session.beginTransaction();

Show me your hibernate.cfg.xml


//////////////////////////////////////////////////////////////////////////

thanks, here are my hibernate.cfg.xml

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

<hibernate-configuration>
<session-factory>
<!-- local connection properties -->
<property name="hibernate.connection.url">
jdbc:mysql://localhost/dating
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.username">dating</property>
<property name="hibernate.connection.password">dating</property>
<property name="hibernate.connection.pool_size">2</property>
<!-- dialect for MySQL -->
<property name="dialect">
net.sf.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<!--property name="jta.UserTransaction">java:comp/UserTransaction</property-->

<!-- Use the C3P0 connection pool. -->
<property name="c3p0.min_size">2</property>
<property name="c3p0.max_size">5</property>
<property name="c3p0.timeout">900</property>

<mapping resource="com/cfreecom/dating/hib2/Cat.hbm.xml" />
<mapping resource="com/cfreecom/dating/hib2/Photo.hbm.xml" />
<mapping resource="com/cfreecom/dating/hib2/Role.hbm.xml" />
<mapping resource="com/cfreecom/dating/hib2/User.hbm.xml" />
</session-factory>
</hibernate-configuration>

/////////////////// tomcat http status 500- Error Report ////////////////////////////
Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoClassDefFoundError: javax/transaction/Synchronization
net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:314)
net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:327)
net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:335)
com.cfreecom.dating.actions.CatAction.execute(CatAction.java:38)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

/////////////////// catalina.out log file ////////////////////////////////

INFO: Reloading this Context has started
18:17:31,982 INFO TilesPlugin:238 - Tiles definition factory loaded for module ''.
18:17:31,992 INFO ValidatorPlugIn:213 - Loading validation rules file from '/WEB-INF/validator-rules.xml'
18:17:31,993 INFO ValidatorPlugIn:213 - Loading validation rules file from '/WEB-INF/validation.xml'
18:17:32,165 INFO TilesPlugin:238 - Tiles definition factory loaded for module '/admin'.
18:17:32,270 INFO ValidatorPlugIn:213 - Loading validation rules file from '/WEB-INF/validator-rules.xml'
18:17:32,272 INFO ValidatorPlugIn:213 - Loading validation rules file from '/WEB-INF/validation.xml'
18:17:34,460 INFO TilesRequestProcessor:105 - Tiles definition factory found for request processor ''.


Hibernate - CatAction ...
ActAction ... try
18:18:03,352 INFO Environment:483 - Hibernate 2.1.8
18:18:03,353 INFO Environment:512 - hibernate.properties not found
18:18:03,359 INFO Environment:543 - using CGLIB reflection optimizer
18:18:03,361 INFO Environment:572 - using JDK 1.4 java.sql.Timestamp handling
18:18:03,365 INFO Configuration:909 - configuring from resource: /hibernate.cfg.xml
18:18:03,365 INFO Configuration:881 - Configuration resource: /hibernate.cfg.xml
18:18:03,482 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Cat.hbm.xml
18:18:03,643 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Cat -> cat
18:18:03,730 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Photo.hbm.xml
18:18:03,749 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Photo -> photo
18:18:03,945 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Role.hbm.xml
18:18:03,953 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Role -> role
18:18:03,964 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/User.hbm.xml
18:18:03,983 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.User -> user
18:18:03,985 INFO Configuration:1067 - Configured SessionFactory: null
18:18:03,988 INFO Configuration:641 - processing one-to-many association mappings
18:18:03,989 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.Role.userSet -> user
18:18:03,990 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.User.photoSet -> photo
18:18:03,990 INFO Configuration:650 - processing one-to-one association property references
18:18:03,991 INFO Configuration:675 - processing foreign key constraints
18:18:04,128 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
18:18:04,139 INFO SettingsFactory:70 - Maximim outer join fetch depth: 2
18:18:04,139 INFO SettingsFactory:74 - Use outer join fetching: true
18:18:04,144 INFO C3P0ConnectionProvider:48 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/dating
18:18:04,145 INFO C3P0ConnectionProvider:49 - Connection properties: {user=dating, password=dating}
18:18:04,187 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
18:18:04,190 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1adb7b8 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@e8a0cd [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxIdleTime -> 900, maxPoolSize -> 5, maxStatements -> 0, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1f8d077 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://localhost/dating, properties -> {user=dating, password=dating} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
18:18:04,530 INFO SettingsFactory:114 - Use scrollable result sets: true
18:18:04,530 INFO SettingsFactory:117 - Use JDBC3 getGeneratedKeys(): true
18:18:04,531 INFO SettingsFactory:120 - Optimize cache for minimal puts: false
18:18:04,531 INFO SettingsFactory:126 - echoing all SQL to stdout
18:18:04,532 INFO SettingsFactory:129 - Query language substitutions: {}
18:18:04,532 INFO SettingsFactory:140 - cache provider: net.sf.hibernate.cache.EhCacheProvider
18:18:04,539 INFO Configuration:1130 - instantiating and configuring caches
18:18:04,552 WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/usr/local/jakarta-tomcat-5.0.28/work/Catalina/localhost/dating/loader/ehcache-failsafe.xml
18:18:04,586 INFO SessionFactoryImpl:119 - building session factory
18:18:04,781 WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
18:18:04,788 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
SessionFactory: net.sf.hibernate.impl.SessionFactoryImpl@3bc1a1

it looks like SessionFactory success ... but exception right after that


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 6:35 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

Try this?

1) put J2EE.jar in the lib path.

if it doesnt work

2) delete the below lines in the hibernate.cfg.xml

<property name="hibernate.connection.username">dating</property>
<property name="hibernate.connection.password">dating</property>

If you are using Mysql you shouldn't give the username and password.
I have worked with Hibernate3.0 I am not sure about Hibernate 2.x

you should get like this in the console , if you print SessionFactory, session, Transaction

SessionFactory ------->org.hibernate.impl.SessionFactoryImpl@1ad98ef
session ------->org.hibernate.impl.SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]] ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
Transaction ------->org.hibernate.transaction.JDBCTransaction@81b1fb

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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