First Donot modify anything in the Tomcat / conf / server.xml
Under WEB-INF/classes folder put the hibernate.cfg.xml
which is given below (remember connection.DataSource 'D' and 'S' should be capital letters.)
<?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>
<property name="connection.DataSource">jdbc/hibernatetest</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernatedb?autoReconnect=true</property>
<property name="driverClassName">org.gjt.mm.mysql.Driver</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>
<!-- Mapping files -->
<mapping resource="config/Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>
then in the web.xml
put the following
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/hibernatetest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
then no setting are required..
it is working for me.
hope this will help you all.
further queries pls mail to
javahelper@gmail.com
Thanks
Lakshmanan