一直提示Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
------------------------------------------
以下是applicactionContext.xml配置信息
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.5.dtd">
<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:jasws="http://cxf.apache.org/jaxws" 
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    
    <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@127.0.0.1:1521:orcl">
</property>
<property name="username" value="boolea"></property>
<property name="password" value="admin"></property>
</bean>
    <bean name="personDao" class="demo.spring.jdbc.dao.impl.PersonDaoImpl">
        <property name="dataSource" ref="dataSource"/>
    </bean>
</beans>
----------------------------------

解决方案 »

  1.   

    数据库信息对了吧,然后就是web.xml里面配置对了吧
      

  2.   

    在搭框架的时候,楼主修改了applicationContext.xml文档的默认路径,原先是在/WEB-INF/,修改后的路径为项目/src下面,启动Tomcat时,故出现applicationContext.xml的路径错误。在web.xml中修改符合如下即可:<context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>classpath:applicationContext.xml</param-value>
      </context-param>
      <listener>
          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      

  3.   

    Caused by: java.net.ConnectException: Connection timed out: connect 很大一个数据库链接超时
      

  4.   

     Connection timed out: connect这不是连接数据库超时嘛,好像不是你的bean.xml的问题吧?看看你的数据库有没有问题