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