今天配置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那项。。。。
这个错误是我第一次碰到。。。