admin 管理员组

文章数量: 887007

解决Caused by: java.net.UnknownHostException: struts.apache.org

在本机上建立一个项目,启动没问题,可以把项目放在另一个电脑上启动时,就报错,内容如下:


Unable to load configuration. - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)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 configuration. - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)... 28 more
Caused by: Unable to load file:/D:/apache-tomcat-6.0.33/webapps/superMapResource/WEB-INF/classes/struts.xml - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:909)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)... 30 more
Caused by: struts.apache - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:904)... 34 more
Caused by: java.UnknownHostException: struts.apacheat java.PlainSocketImpl.connect(PlainSocketImpl.java:177)at java.SocksSocketImpl.connect(SocksSocketImpl.java:366)at java.Socket.connect(Socket.java:519)at java.Socket.connect(Socket.java:469)at sun.NetworkClient.doConnect(NetworkClient.java:163)at sun.www.http.HttpClient.openServer(HttpClient.java:394)at sun.www.http.HttpClient.openServer(HttpClient.java:529)at sun.www.http.HttpClient.<init>(HttpClient.java:233)at sun.www.http.HttpClient.New(HttpClient.java:306)at sun.www.http.HttpClient.New(HttpClient.java:323)at sun.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:852)at sun.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)at sun.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:718)at sun.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1041)at com.sun.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)at com.sun.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)at com.sun.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)at com.sun.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1089)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1002)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)at com.sun.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)at com.sun.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)at com.sun.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)at com.sun.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)at com.sun.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)... 35 more
2013-04-01 12:55:01,750 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]:42 - Parsing configuration file [struts-default.xml]
2013-04-01 12:55:01,765 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]:42 - Parsing configuration file [struts-plugin.xml]
2013-04-01 12:55:01,781 ERROR [org.apache.struts2.dispatcher.Dispatcher]:38 - Dispatcher initialization failed
Unable to load configuration. - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)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.33/webapps/superMapResource/WEB-INF/classes/struts.xml - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:909)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)... 31 more
Caused by: struts.apache - Class: java.PlainSocketImpl
File: PlainSocketImpl.java
Method: connect
Line: 177 - java/net/PlainSocketImpl.java:177:-1at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:904)... 35 more
Caused by: java.UnknownHostException: struts.apacheat java.PlainSocketImpl.connect(PlainSocketImpl.java:177)at java.SocksSocketImpl.connect(SocksSocketImpl.java:366)at java.Socket.connect(Socket.java:519)at java.Socket.connect(Socket.java:469)at sun.NetworkClient.doConnect(NetworkClient.java:163)at sun.www.http.HttpClient.openServer(HttpClient.java:394)at sun.www.http.HttpClient.openServer(HttpClient.java:529)at sun.www.http.HttpClient.<init>(HttpClient.java:233)at sun.www.http.HttpClient.New(HttpClient.java:306)at sun.www.http.HttpClient.New(HttpClient.java:323)at sun.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:852)at sun.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)at sun.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:718)at sun.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1041)at com.sun.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)at com.sun.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)at com.sun.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)at com.sun.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1089)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1002)at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)at com.sun.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)at com.sun.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)at com.sun.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)at com.sun.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)at com.sun.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

从网上搜了下,发现是struts.xml中dtd引入路径的问题。解决方法如下:

打开struts.xml文件

"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" ".3.dtd"

替换为:"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" ".0.dtd"


本文标签: 解决Caused by javanetUnknownHostException strutsapacheorg