码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2018-04-30 11:54:28      阅读:544      评论:0      收藏:0      [点我收藏+]

标签:apach   分享   ica   except   manager   imp   lan   ini   eth   

启动项目后报这个错

Line: 184 - java/net/AbstractPlainSocketImpl.java:184:-1
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
 at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
Caused by: Unable to load file:/D:/apache-tomcat-7.0.52/webapps/graduatephotos/WEB-INF/classes/struts.xml - Class: java.net.AbstractPlainSocketImpl
File: AbstractPlainSocketImpl.java
Method: connect
Line: 184 - java/net/AbstractPlainSocketImpl.java:184:-1
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1022)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:165)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:132)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:225)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
 ... 16 more
Caused by: struts.apache.org - Class: java.net.AbstractPlainSocketImpl
File: AbstractPlainSocketImpl.java
Method: connect
Line: 184 - java/net/AbstractPlainSocketImpl.java:184:-1
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1017)
 ... 20 more
Caused by: java.net.UnknownHostException: struts.apache.org
 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
 at java.net.Socket.connect(Socket.java:589)
 at java.net.Socket.connect(Socket.java:538)

报错的原因就是因为没有联网,它无法加载"http://struts.apache.org/dtds/struts-2.5.dtd这个DTD文件,所以报错,解决办法除了让电脑连上网之外,就是修改"http://struts.apache.org/dtds/struts-2.5.dtd对应的文件位置,让它从本地去查找这个DTD文件,而不是在网上加载这个文件,做法如下:

  技术分享图片

 技术分享图片

Struts中的dtd文件地址:struts-2.3.15.3-all\src\core\src\main\resources

URL地址:

技术分享图片

 

 这样设置好后,即使不联网也能正常加载dtd文件了

 

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

标签:apach   分享   ica   except   manager   imp   lan   ini   eth   

原文地址:https://www.cnblogs.com/fengyuhuawu/p/8973021.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!