组件“struts-config”在此不允许“message-resources”。这个算什么错误,错误在哪里呢??

pengfeitian 2005-01-14 11:19:47
错误提示:
ERROR org.apache.commons.digester.Digester.error(Digester.java:1439) : Parse Error at line 178 column -1: 组件“struts-config”在此不允许“message-resources”。
org.xml.sax.SAXParseException: 组件“struts-config”在此不允许“message-resources”。
at org.apache.crimson.parser.Parser2.error(Unknown Source)
at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(Unknown Source)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.content(Unknown Source)
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1004)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:953)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:469)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3427)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3628)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

///////////////////
我看了我的struts-config.xml文件,我得文件有很多的<!---->这样注释,但找不出问题所在,请高手赐教!
...全文
129 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hxzg001 2005-01-14
  • 打赏
  • 举报
回复
message-resources放在最后,plug-in之前
eureka0891 2005-01-14
  • 打赏
  • 举报
回复
struts-config写的地方错了,不符合dtd检验,
可以用easy-struts或者eclise(装一下:xml检验的)
pengfeitian 2005-01-14
  • 打赏
  • 举报
回复
tomcat启动的时候报错:
ERROR org.apache.commons.digester.Digester.error(Digester.java:1439) : Parse Error at line 178 column -1: 组件“struts-config”在此不允许“message-resources”。
org.xml.sax.SAXParseException: 组件“struts-config”在此不允许“message-resources”。
///////////怎么回出现这个问题,请帮忙解决一下
pengfeitian 2005-01-14
  • 打赏
  • 举报
回复
揭帖
以梦为马 2005-01-14
  • 打赏
  • 举报
回复
友情up。
pengfeitian 2005-01-14
  • 打赏
  • 举报
回复
我发现了
<message-resources parameter="ApplicationResources" null="false" />
夹在plug-in之间,所以错了,呵呵,谢谢各位了

to vvfish119(肥肥) ,eureka0891() , hxzg001(大家踊跃结贴啊)

我得msn是: luck_g8@hotmail.com,大家加我吧,有机会一起探讨研究
pengfeitian 2005-01-14
  • 打赏
  • 举报
回复
我是按规范来做的,请大家审核一下,


<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- ============================================ Data Source Configuration -->
<!--
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="org.postgresql.Driver" />
<set-property
property="url"
value="jdbc:postgresql://localhost/mydatabase" />
<set-property
property="username"
value="me" />
<set-property
property="password"
value="test" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<set-property
property="validationQuery"
value="SELECT COUNT(*) FROM market" />
</data-source>
</data-sources>
-->
<!-- ================================================ Form Bean Definitions -->
<form-beans>
<form-bean name="contentForm" type="wap.struts.ContentForm" />
<form-bean name="contentTypeForm" type="wap.struts.ContentTypeForm" />
<form-bean name="menuForm" type="wap.struts.MenuActionForm" />
<form-bean name="serviceForm" type="wap.struts.ServiceActionForm" />
</form-beans>
<!-- ========================================= Global Exception Definitions -->
<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>
<!-- =========================================== Global Forward Definitions -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
</global-forwards>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<!--content-->
<action path="/addContent" type="wap.struts.ContentAction" name="contentForm" scope="request" validate="true" input="source.page.add">
<forward name="index" path="source.page.add"/>
</action>
<action path="/contentType" type="wap.struts.ContentTypeAction" name="contentTypeForm" scope="request" validate="true" input="source.page.type">
<forward name="index" path="source.page.type"/>
</action>
<!--menu-->
<action path="/listMenu" type="wap.struts.MenuAction" name="menuForm" scope="request" validate="true" input="menu.list.page">
<forward name="success" path="menu.list.page"/>
</action>
<action path="/modifyMenu" type="wap.struts.MenuAction" name="menuForm" scope="request" validate="true" input="menu.list.page">
<forward name="success" path="menu.update.page"/>
</action>
<action path="/addMenu" type="wap.struts.MenuAction" name="menuForm" scope="request" validate="true" input="menu.list.page">
<forward name="success" path="menu.list.page"/>
</action>
<!--service-->
<action path="/listService" type="wap.struts.ServiceAction" name="serviceForm" scope="request" validate="true" input="service.list.page">
<forward name="success" path="service.list.page"/>
</action>
<action path="/modifyService" type="wap.struts.ServiceAction" name="serviceForm" scope="request" validate="true" input="service.list.page">
<forward name="insert" path="service.insert.page"/>
<forward name="update" path="service.update.page"/>
</action>
<action path="/addService" type="wap.struts.ServiceAction" name="serviceForm" scope="request" validate="true" input="service.list.page">
<forward name="success" path="service.list.page"/>
</action>
<action path="/updateService" type="wap.struts.ServiceAction" name="serviceForm" scope="request" validate="true" input="service.list.page">
<forward name="success" path="service.list.page"/>
</action>
<!-- sample input and input submit actions

<action
path="/Input"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Input.jsp"/>
<action
path="/edit*"
type="app.Edit{1}Action"
name="inputForm"
scope="request"
validate="true"
input="/pages/Edit{1}.jsp"/>
end samples -->
</action-mappings>


<!-- ============================================= Controller Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<!-- =============================================== Plug Ins Configuration -->
<!-- ======================================================= Tiles plugin -->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<!-- Path to XML definition file -->
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- message resources -->
<message-resources parameter="ApplicationResources" null="false" />
<!-- =================================================== Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>

vvfish119 2005-01-14
  • 打赏
  • 举报
回复
你的struts-config.xml有问题,不符合良构的xml规范或者不符合dtd规范

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧