Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection t

今天配置spring的是一直出现错误

 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in URL [file:/D:/Project/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/hibernate_test/WEB-INF/classes/beans.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect

感觉是mysessionFactory出错了,但是始终没查出来那错。。。网上找了一些说dtd网连不上,但是也不适用。。。

最后查出是 

 

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
  <property name="url" value="jdbc:oracle:thin:scott/tiger@//localhost:1521/orcl"/>
  <property name="username" value="scott"/>
  <property name="password" value="tiger"/>
  </bean>


应改成

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"/>
    <property name="username" value="scott"/>
    <property name="password" value="tiger"/>
  </bean>


注意url那项。。。。

这个错误是我第一次碰到。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值