Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Spring + Hibernate: applicationContext.xml not working  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

applicationContext.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"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

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

<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>

<bean id="myHibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop
key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="hibernate.hbm2ddl.auto">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>
<prop
key="hibernate.c3p0.testConnectionOnCheckout">false</prop>
</props>
</property>
</bean>

<bean id="mySessionFactory"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="myDataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/ifang/hibernatemap/Category.hbm.xml</value>
<value>com/ifang/hibernatemap/Item.hbm.xml</value>
<value>com/ifang/hibernatemap/Pano.hbm.xml</value>
<value>com/ifang/hibernatemap/PanoCategory.hbm.xml</value>
<value>com/ifang/hibernatemap/PanoItem.hbm.xml</value>
<value>com/ifang/hibernatemap/PanoProvider.hbm.xml</value>
<value>com/ifang/hibernatemap/PremiumPano.hbm.xml</value>
<value>com/ifang/hibernatemap/SubCategory.hbm.xml</value>
<value>com/ifang/hibernatemap/SubItem.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<ref bean="myHibernateProperties" />
</property>
</bean>

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

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

</beans>



Please, someone help!!!
 
ranger
Posts: 17344
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.

Thanks

Mark
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also it'll help if you could post your stack trace.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!