问题:
geoserver源码已编译成功,但在IDEA环境下正常启动调试失败,报错如下:
Failed startup of context o.e.j.w.WebAppContext@74a6a609{/geoserver, file:///D:/work/geoserver/src/web/app/src/main/webapp/, UNAVAILABLE}{src/main/webapp}
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.sochetConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
解决方法:
上述报错是由于启动调试时会联网访问(java.sun.com/23.33.94.164:80)造成的,修改gs-web-app工程下的src/main/webapp/WEB-INF/web.xml,将DOCTYPE标签注释起来即可,修改如下:
<?xml version="1.0" encoding="UTF-8"?> <!--<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD WebApplication 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">--> <web-app> <display-name>GeoServer></display-name> <context-param> <param-name>serviceStrategy</param-name> ......