• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection time out error while deploying Spring app  RSS feed

Pratyusha jag
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I’ve just started learning Spring and I’m using Spring MVC framework to create a simple webapp to take a name in a text field in one page and on submit the value is inserted in an MS access database and a greeting is displayed in another page saying “hello, <name>!”. While trying to deploy my simple Spring web app, I am getting the following errors.

SEVERE: Context initialization failed

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.net.ConnectException: Connection timed out: connect

java.net.ConnectException: Connection timed out: connect

My applicationContext.xml and web.xml files are as follows:

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

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">


<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" scope="singleton" destroy-method="close">

<property name="driverClassName" value="sun.jdbc.odbc.JdbcOdbcDriver" />

<property name="url" value="jdbcdbc:jdbcodbcdriver:;DRIVER=Microsoft Access Driver (*.accdb);DBQ=D:\206132\usernamedb.accdb;" />

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

<property name="password" value="password" />



The code to access the db is as below:

package SpringClasses;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

public class Profile {

private String username;

private JdbcTemplate jt;

private DataSource dataSource;

public Profile() {

public Profile(String username) {

this.username = username;


public String getUsername() {

System.out.println("username " + username);

return username;


public void setUsername(String username) {

int rowsInserted;

jt = new JdbcTemplate(dataSource);

rowsInserted = jt.update("insert into usernamedb (username) values(?)",new Object[] { username });



public void setDataSource(DataSource dataSource) {

this.dataSource = dataSource;




I am unable to figure out the reason for the connection timed error. I have also added this data base under control panel -> administrative tools -> Data Sources (ODBC) -> both User DSN and System DSN.

Help is much appreciated.



Maneesh Godbole
Posts: 11445
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"javagurl java

Please check your private messages for an important administrative matter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!