File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Spring + Hibernate: applicationContext.xml not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring + Hibernate: applicationContext.xml not working" Watch "Spring + Hibernate: applicationContext.xml not working" New topic

Spring + Hibernate: applicationContext.xml not working

soonphei tin

Joined: May 01, 2009
Posts: 2

I am new in Spring as well as Hibernate. I am developing an application base on Spring, Tomcat, Hibernate, and mySQL. I used NetBeans 6.5
Before the configuration is set in applicationContext.xml everything is alright. Once I added the following, Apache Tomcat return "The requested resource () is not available." when I run the project.

The framework I am using: -
1. Spring Web MVC 2.5
2. Hibernate 3.2.5
3. commons-dbcp-1.2.2.jar
4. spring-hibernate3.jar
5. Tomcat 6.0
6. MySQL 5.1


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/conf/" />

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
<property name="url"><value>jdbc:mysql://localhost:3306/ifang</value></property>
<property name="username"><value>root</value></property>
<property name="password"><value>adminadmin</value></property>
<property name="initialSize"><value>3</value></property>

<bean id="myHibernateProperties"
<property name="properties">
key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.c3p0.minPoolSize">5</prop>
<prop key="hibernate.c3p0.maxPoolSize">20</prop>
<prop key="hibernate.c3p0.timeout">600</prop>
<prop key="hibernate.c3p0.max_statement">50</prop>
<prop key="hibernate.current_session_context_class">thread</prop>

<bean id="mySessionFactory"
<property name="dataSource">
<ref local="myDataSource" />
<property name="mappingResources">
<property name="hibernateProperties">
<ref bean="myHibernateProperties" />

<bean id="categoryDAO" class="com.ifang.DAO.CategoryDAO">
<property name="sessionFactory" ref="mySessionFactory" />

<!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->


Please, someone help!!!
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17250

"sp tin"

Please click on the My Profile link above and change your display name to meet the JavaRanch Naming Policy of using your real first and real last names.

Also, when posting code or xml configuration, please use the CODE tags so that the code keeps its formatting and indentation. Right now I can't read your xml. The CODE tags get created when you click the Code button above.

Lastly, I don't understand what you are asking. It says you added something, but you don't tell us what you added. What was working, then what did you change that it is now not working.



Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mudit Srivastava
Ranch Hand

Joined: Apr 30, 2007
Posts: 38
also it'll help if you could post your stack trace.
subject: Spring + Hibernate: applicationContext.xml not working