Get your CodeRanch badge!*
The moose likes Spring and the fly likes Spring Cofiguratation error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Cofiguratation error " Watch "Spring Cofiguratation error " New topic

Spring Cofiguratation error

premkumar Nagaraj

Joined: Feb 15, 2012
Posts: 4
Dear friends,

Kindly help me how to solve the problem:

SEVERE: Context initialization failed

Note : this is my dispatcher-servlet.xml

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

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/JSP/"/>
<property name="suffix" value=".jsp"/>

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource"
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbcracle:thin:@" />
<property name="username" value="scoot" />
<property name="password" value="tiger" />

<bean id="mySessionFactory"
<property name="dataSource" ref="myDataSource" />
<property name="annotatedClasses">
<property name="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="">update</prop>
<bean id="myUserDAO" class="com.dao.UserDaoImp">
<property name="sessionFactory" ref="mySessionFactory" />

<bean name="/JSP/hello_world.html" class="com.contoraller.HelloWorldController">
<property name="userDAO" ref="myUserDAO" />

Thanks & regards,
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Whenever you get an exception from Spring on your configuration, it is best to scroll to the bottom of your stack trace and work you way up till you see the root cause. This error message will tell you exactly what is the problem. You didn't post the stack trace here, so we can't see. Also you posted your configuration without using the CODE tag to keep the files indentation so it is easier for us to read.

Is this a typo for username

<property name="username" value="scoot" />

Isn't it supposed to be scott not scoot?
Also, I ask this when I see this in configuration. Are you new to Spring and starting to learn? If so, I recommend you look for more updated materials. Your use of <bean name="/JSP/hello_world.html" class="com.contoraller.HelloWorldController"> tells me you are using older style of Spring MVC, which isn't used in today's Spring applications. Today's Spring applications are still backwards compatible. But I highly recommend for new users to use the latest best practices instead.

Hope that helps


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Spring Cofiguratation error
Similar Threads
exceptions in spring configuration file.
how does rollbackFor work ?
Simple navigation rule
Spring + Hibernate: applicationContext.xml not working
Dependency injection problem