转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/6015693.html
前段时间,项目部署到现场后,反馈Tomcat能正常启动,但是项目有时访问不了也不报错。Tomcat的log文件中报错大概如下:
Line: 178 - java/net/AbstractPlainSocketImpl.java:178:-1
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:835)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
最后发现:只要断网,项目就无法访问任何网页都打不开,在联网情况下访问正常。
原来,在struts.xml文件中DOCTYPE定义是:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
但是我放入的xwork的jar包确是2.1的,所以在有网的情况下会访问网上的2.0.dtd,没网就报错了。改成:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
启动正常。特此记录!