启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration. - Class: java.net.PlainSocketImpl

今天刚好宿舍断网,打开电脑,打开ide工具,启动tomcat后,访问web项目工程,页面显示404,查看控制台,运行报错信息如下:

严重: Exception starting filter struts2
Unable to load configuration. - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load file:/D:/apache-tomcat-6.0.37/webapps/spring-ssh/WEB-INF/classes/struts.xml - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:890)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:144)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:111)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:164)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 31 more
Caused by: struts.apache.org - Class: java.net.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:885)
    ... 35 more
Caused by: java.net.UnknownHostException: struts.apache.org
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
    at sun.net.www.http.HttpClient.New(HttpClient.java:306)
    at sun.net.www.http.HttpClient.New(HttpClient.java:323)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:790)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:731)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:656)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:979)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1089)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1002)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113)
    ... 36 more
2015-6-7 10:06:10 org.apache.catalina.core.StandardContext start
严重: Error filterStart

很明显,上面的报错是struts2框架的报错信息,奇怪!我昨天晚上还可以访问这个工程的,怎么今天早上就不行了?难道是因为今天断网的原因?

我带着疑惑,寻找解决方法,web工程源码和部署都在本地电脑的,认真查看报错信息,Unable to load configuration. - Class: java.net.PlainSocketImpl,好像是没有在网络找到这个类的原因,struts2解析xml的时候要连struts.apache.org主机, 这个在断网的情况下肯定是不行的; 所以报错吧

后来我查看了struts.xml配置文件,发现struts.xml定义的版本和 struts2-core-2.1.6.jar里面的struts-default.xml版本不一致!!

struts-default.xml文件里面定义的<!DOCTYPE ...>如下:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">

而struts.xm文件定义的<!DOCTYPE ...>为:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">

注意struts-2.x.x后面的版本,报错的原因正是这里不一致所导致的!

解决方法:将struts-default.xml文件里面定义的<!DOCTYPE ...>复制粘贴覆盖到struts.xm文件定义的<!DOCTYPE ...>,以上报错的问题成功解决,关闭tomcat后,再重新启动tomcat,可以成功访问到web工程。

时间: 2024-10-11 10:59:43

启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration. - Class: java.net.PlainSocketImpl的相关文章

启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration.

启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration. 出现此异常是因为,struts.xml定义的版本和 struts2-core-2.1.6.jar里面的struts-default.xml版本不一致!! struts-default.xml文件里面定义的<!DOCTYPE ...>如下: <!DOCTYPE struts PUBLIC "-//Apach

structs2中,启动Tomcat时异常:严重: Exception starting filter struts2 java.lang.NullPointerException

structs2中,已搭建好structs2开发环境,程序无任何问题.但是,部署好项目之后,启动Tomcat时Console报错抛出异常: 严重: Exception starting filter struts2 java.lang.NullPointerException 如下图所示: 出现这个错误的原因是:这是struts-2.1.6版本的一个BUG,配置文件中设置了开发者模式,即structs.xml中包含了<constant name="struts.devMode"

Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%209.0/webapps/Teacher04/WEB-INF/classes/struts.xml:9:54

发布一个struts2项目的时候tomcat显示下面这个错误,我的本能感觉就是我的struts.xml或者web.xml写错了,可是我字母找都没发现,于是百度一番,可是我对那些人的回答表示怀疑,感觉应该不行,直到我一直找下去,发现一个不起眼的回答说出了我需要的回答 我回来一看,发现我的错误里的确有这个struts.xml:9:54,于是看一下我的struts.xml,我要哭了 严重: Exception starting filter struts2 Unable to load configu

Struts 2.x Unable to load configuration. - action

问题分析:遇到该问题一般是struts中某个配置文件没有正确配置,比如: 1.class中的TestAction没有成功加载: <constant name="struts.i18n.reload" value="true" /> <!-- <include file="struts/struts-test.xml"/> --> <package name="system" exten

出现错误:Unable to load configuration. - action - file:/E:/Java/Tomcat7.0/apache-tomcat-7.0.68-windows-x64/apache-tomcat-7.0.68/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:8:43

严重: Exception starting filter struts2 Unable to load configuration. - action - file:/E:/Java/Tomcat7.0/apache-tomcat-7.0.68-windows-x64/apache-tomcat-7.0.68/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:8:43 at org.apache.struts2.dispatcher.Dispat

项目部署到tomcat6.0启动成功后访问页面报500错误解决方法

如题:项目部署到tomcat6.0启动成功后访问页面报500错误解决方法,很奇葩,启动的时候没有任何问题,但输入访问地址后报500,去年国庆放假前夕,为这个问题伤神了半天最后解决了,今天又碰到了,乍一看摸不着头,后面仔细回想了下,迅速解决了问题. 原因:项目里面的jar和tomcat里面lib里面的jar重复了. 解决方法: 1.要么更换tomcat7或之后的版本,之后的版本就不会出现这个问题. 2.去部署之后的tomcat的webapps\项目名\WEB-INF\lib 里面删掉jsp-api

启动tomcat后出现红色警告

启动tomcat后出现红色警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webProject' did not find a matching property. 这是因为我们在eclipse下,通过tomcat部署web工程时,tomcat的配置文件server.xml中会自动生成一个关于该web工程的配置信

IntelliJ IDEA启动Tomcat后,却无法访问Tomcat主页

1.IntelliJ IDEA启动Tomcat后,却无法访问Tomcat主页 转:http://www.myexception.cn/other/1998827.html https://blog.csdn.net/pzasdq/article/details/52537337 2.IntelliJ IDEA关于“cannot resolve symbol servlet”的解决 https://blog.csdn.net/just_now_and_future/article/details/

tomcat启动异常(严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] )

严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConf