• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate configuration with spring

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have configured hibernate with spring frame work and have written a simple web application to fetch the data from the data base and display it in the jsp. I have put the hibernate.cfg.xml in WEB-INF/classes folder. I have deployed the appliaction in apache-tomcat 6.I start the server and run the application, the application is not able to fetch the data. It displays a message 'Invalid Configuration' in the tomcat log. Please help me to rectify this problem. Im attaching the hibernate.cfg.xml . find the tomcat logs below.

tomcat logs
-------------------

Oct 21, 2010 11:15:05 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory projects
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Oct 21, 2010 11:15:06 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 21, 2010 11:15:07 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Oct 21, 2010 11:15:07 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Oct 21, 2010 11:15:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15154 ms
invalid configuration


hibernate.cfg.xml
--------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="dharma"/>
<property name="password" value="dharma"/>
</bean>

<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="myDataSource"/>
<property name="mappingResources">
<list>
<value>/WEB-INF/employee.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
</prop>
<prop key="show_sql">true</prop>
</props>
</property>
</bean>

<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="mySessionFactory"/>
</property>
</bean>

<bean id="employeeDao" class="servlet.dao.EmployeeDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>


</beans>
 
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ehm... that's not what a hibernate.cfg.xml file is supposed to look like. See http://docs.jboss.org/hibernate/core/3.3/reference/en/html/tutorial.html#tutorial-firstapp-configuration
By the way: use code tags.
 
Dharmakumar Gajendran
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot dude! I love your solution
reply
    Bookmark Topic Watch Topic
  • New Topic