最近在做SSH的项目,遇到了
org.dom4j.DocumentException: Connection timed out
Connection timed out: connect Nested exception: Connection timed out: connect
提示连接超时,上网百度了半天,找不到点合适的解决方案,进一步知道读取配置文件超时,可能是网速不好的原因,直接把dtd文件下载到服务器上不就可以了吗?
为了不改动配置文件,下面提供决解方法(有更好的办法请大牛很指点):
一、
在本地服务器上安装一个安装Apache2.2.x ,为什么不用tomcat你懂的,教程在这里http://indian.blog.163.com/blog/static/1088158200755105546704/
二、
接下来找到相应的dtd、xsd,放到对应的目录下(hibernate、struts2、spring的文件都整理下),比如:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
把spring-beans-2.5.xsd放到schema/beans目录(需要新建)
如图:
三、
把以上文件全部复制到 Apache的根目录下的htdocs文件中
……\Apache Software Foundation\Apache2.2\htdocs
四、
向C:\Windows\System32\drivers\etc\hosts 文件添加(其中IP地址自己修改咯):
192.168.1.102 www.hibernate.org
192.168.1.102 www.springframework.org
192.168.1.102 struts.apache.org
192.168.1.102 www.springframework.org
192.168.1.102 struts.apache.org
说明:在hosts中添加上述信息后,这些网站就不能正常打开了,需要删除以上内容才可以,各位同志们注意了
(原创文章,未经授权,禁止转摘。)