论坛首页 编程语言技术论坛

关于struts1在断网情况下出现javax.servlet.UnavailableException

浏览 2767 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-12-21  

这两天自己在钻研struts1,晚上也学习到十一点多,然后我们学校寝室是十一点停电,意味着断网(路由器),用的是笔记本,然后在弄struts1,没停电的时候没断网启动多少次服务器都没问题。但是断网去诡异了,服务器启动不起来,一启动就报错,一下就是这个异常信息,经过自己多出网上查资料发现全是由于struts-config.xml文件的问题,里面引入的dtd就是罪魁祸首。

2011-12-20 23:22:48 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\MyEclipseCommon\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;D:\MyEclipseCommon\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_8.5.0.me201003121946\tomcat\bin
2011-12-20 23:22:54 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2011-12-20 23:22:54 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 24162 ms
2011-12-20 23:22:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-12-20 23:22:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
2011-12-20 23:23:05 org.apache.struts.action.ActionServlet initChain
信息: Loading chain catalog from jar:file:/D:/MyEclipse%208.5Workspaces/.metadata/.me_tcat/webapps/DisPatchActionDemo/WEB-INF/lib/struts-core-1.3.10.jar!/org/apache/struts/chain/chain-config.xml
2011-12-20 23:23:16 org.apache.struts.action.ActionServlet initChain
信息: Loading chain catalog from jar:file:/D:/MyEclipse%208.5Workspaces/.metadata/.me_tcat/webapps/DownloadActionTest/WEB-INF/lib/struts-core-1.3.10.jar!/org/apache/struts/chain/chain-config.xml
log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly.
2011-12-20 23:23:32 org.apache.catalina.core.ApplicationContext log
信息: Marking servlet action as unavailable
2011-12-20 23:23:32 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /messageboard threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:767)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:741)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:685)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:331)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2011-12-20 23:23:32 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2011-12-20 23:23:33 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2011-12-20 23:23:33 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/88 config=null
2011-12-20 23:23:33 org.apache.catalina.startup.Catalina start
信息: Server startup in 38330 ms

以下是解决办法

struts-config.xml如下配置:

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

不能上网就会出现以上的异常

办法一:

换个头

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
可以搞定

办法二:

这是由于struts-config.xml中的dtd校验中的地址为 http://struts.apache.org/dtds/struts-config_1_3.dtd,按照这个地址将struts-config_1_3.dtd下载后放到和struts-config.xml同一文件夹下,然后将struts-config.xml中替换为struts-config_1_3.dtd就可以了

论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics