struts2 <constant name="struts.devMode" value="true" /> 报错

本文详细解析了Struts2启动失败时出现的异常信息,并指出可能的原因是Tomcat安装目录中存在空格。通过提供解决方法,确保了正确配置Tomcat路径,成功解决了Struts2无法正常启动的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/Struts2_2] has not been started
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.i18n.reload - old value: false new value: true
2009-12-31 20:05:29 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.configuration.xml.reload - old value: false new value: true
2009-12-31 20:05:31 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
java.lang.NullPointerException
at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)
at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)
at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)
at org.apache.struts2.dispatcher.ng.InitOperations.initStaticContentLoader(InitOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:49)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1307)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
at java.lang.Thread.run(Unknown Source)
2009-12-31 20:05:31 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2009-12-31 20:05:31 org.apache.catalina.core.StandardContext start
严重: Context [/Struts2_2] startup failed due to previous errors


错误原因:
tomcat的安装目录有空格。
解决方法:(去掉空格就OK!)
我的是“F:\Program Files\tomcat6.0” 中间有一个空格。
<?xml version="1.0" encoding="UTF-8" ?> <!-- /* * $Id: struts-plugin.xml 722219 2008-12-01 20:41:26Z musachy $ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ --> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <bean class="com.inc.sbu.view.FreeMarkerPageFilter" static="true" optional="true"/> <constant name="struts.ognl.allowStaticMethodAccess" value="true" /> <constant name="struts.convention.relative.result.types" value="freemarker,dispatcher"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.package.locators" value="web,action" /> <constant name="struts.convention.default.parent.package" value="yk-default"/> <constant name="struts.convention.result.path" value="/pages"/> <constant name="struts.convention.result.flatLayout" value="true"/> <constant name="struts.i18n.encoding" value="gbk" /> <constant name="struts.i18n.reload" value="false" /> <constant name="struts.devMode" value="false" /> <constant name="struts.serve.static.browserCache" value="false"/> <constant name="struts.configuration.xml.reload" value="false" /> <constant name="struts.custom.i18n.resources" value="globalMessages" /> <constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" /> <constant name="struts.multipart.saveDir" value="/tmp"/> <constant name="struts.multipart.maxSize" value="1000000000" /> <constant name="struts.ui.theme" value="simple"/> <constant name="struts.action.extension" value="xhtml,,json" /> <constant name="struts.enable.DynamicMethodInvocation" value="true"/> <package name="yk-default" extends="struts-default"> <result-types> <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/> <result-type name="json" class="org.apache.struts2.json.JSONResult"/> </result-types> <interceptors> <interceptor class="com.inc.sbu.struts.AuctionInterceptor" name="auctionInterceptor"/> <interceptor class="com.inc.sbu.struts.TokenInterceptor" name="incTokenInterceptor"/> <interceptor class="com.inc.sbu.struts.WorkFlowInterceptor" name="incFlowInterceptor"/> <interceptor class="com.inc.sbu.util.FileUploadInterceptor" name="fileUploadInterceptor"/> <interceptor class="com.inc.sbu.struts.ClewInterceptor" name="clewInterceptor"/> <interceptor-stack name="bidStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="profiling"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</param> </interceptor-ref> <interceptor-ref name="conversionError"/> <interceptor-ref name="auctionInterceptor"/> </interceptor-stack> <interceptor-stack name="subStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="i18n"/> <interceptor-ref name="prepare"/> <interceptor-ref name="chain"/> <interceptor-ref name="profiling"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="fileUploadInterceptor"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</param> </interceptor-ref> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,inputxy,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="clewInterceptor"> <param name="excludeMethods">login,loginManager,logout,index</param> </interceptor-ref> <interceptor-ref name="incTokenInterceptor"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="subStack"/> <global-results> <result name="invalid.token">/pages/error/repeat-submit.jsp</result> <result name="clew" type="dispatcher">/pages/clew.jsp</result> <result name="manage-clew" type="dispatcher">/pages/manage-clew.jsp</result> <result name="auction-clew" type="dispatcher">/pages/auction-clew.jsp</result> <result name="syserror" type="dispatcher">/pages/error.jsp</result> <result name="validerror" type="dispatcher">/pages/error.jsp</result> <result name="frontpurviewerror" type="dispatcher">/pages/error/frontpurviewerror.jsp</result> <result name="frontloginerror" type="dispatcher">/pages/error/frontpurviewerror.jsp</result> <result name="fronterror" type="dispatcher">/pages/error/frontticketerror.jsp</result> <result name="filenotfound" type="dispatcher">/pages/error/filenotfound.jsp</result> <result name="login" type="redirect">/login</result> <result name="adminLogin" type="dispatcher">/login.jsp</result> <result name="login" type="redirect">/login</result> <result name="entran" type="redirect">/entran</result> <!-- <result name="adminLogin" type="dispatcher">/login.jsp</result> --> <result name="auctionAdminError" type="redirect">/auction/adminLogin</result> <result name="auctionActorError" type="redirect">/auction/login</result> </global-results> </package> <!-- Overwrite Convention --> </struts> 我现在需要重写fileUpload,即不再使用fileUpload的拦截器,需要怎么配置
最新发布
08-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值