-1

我已经彻底搜索了这个主题并打开了 log4j 的调试级别,但是 MenuContextListener 根本不会启动。这是我掌握的信息:

我的 web.xml 文件

 <listener> 
    <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class> 
 </listener> 

 <context-param>   
    <param-name>menuConfigLocation</param-name>   
    <param-value>/WEB-INF/classes/menu-config.xml</param-value>   
 </context-param> 

我的 menu-config.xml 文件

<?xml version="1.0" encoding="UTF-8" ?>

<MenuConfig>

<Displayers>
   <Displayer name="TabbedMenu" type="net.sf.navigator.displayer.TabbedMenuDisplayer" />
</Displayers>

<Menus>
   <Menu name="selectAction" title="Select Action" location="SelectAction">
       <Item name="report" title="Report" location="Report"/>
       <Item name="query" title="Query" location="Query"/>
       <Item name="listings" title="Listings" location="Listings"/>
   </Menu>
</Menus>

</MenuConfig>

我的 log4j 信息

May 21, 2011 1:02:33 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive myproject.war
context path = /myproject
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.TX
log4j:ERROR Could not instantiate appender named "TX".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
log4j:ERROR Could not find value for key log4j.appender.R
log4j:ERROR Could not instantiate appender named "R".
2011-05-21 13:02:52 MenuContextListener [DEBUG] Starting struts-menu initialization
2011-05-21 13:02:52 MenuContextListener [DEBUG] using menuConfigLocation: /WEBINF/classes/menu-config.xml
May 21, 2011 1:02:52 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 21, 2011 1:02:52 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/myproject] startup failed due to previous errors
2011-05-21 13:02:52 MenuContextListener [DEBUG] destroying struts-menu...
May 21, 2011 1:02:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
context path = /docs
May 21, 2011 1:02:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
context path = /examples
May 21, 2011 1:02:53 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 21, 2011 1:02:53 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
May 21, 2011 1:02:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 35104 ms

因此,您会看到为此侦听器调用了 contextInitialize,但该方法没有完成,因为 MenuContextListener 中应该还有 1 条日志语句告诉我们成功或失败。然后我们突然调用了 contextDestroyed ,就是这样。

4

1 回答 1

2

因此,任何地方都绝对没有任何日志可以为我提供更多信息。无处!我为找到问题所做的工作是,我不得不煞费苦心地梳理 struts-main 的源代码。我发现了什么?在 MenuRepository.java 中有一个 commons-digester 的导入。公地消化器?这在任何文档中提到或包含在任何下载中?我不使用公共消化器。

这是我对此的看法,如果我错了,请任何人纠正我,或者确认这是否正确。回到 struts 1.x 时,commons-digester 是 struts 包的一部分,那么为什么要在 struts-menu 文档中提及 commons-digester?现在不再是这种情况,因此必须单独下载 commons-digester。所以我的结论是,在某个地方需要有文档说明如何将这个包与 struts 2.x 成功结合。

另外,谁能给我任何 2011 年使用 struts-menu 的替代方案?我有一个菜单,当用户将鼠标悬停在它上面时,它会在右侧打开。这与 struts-menu 中包含的 Velocity CoolWindows 示例非常相似。

于 2011-05-22T13:43:24.573 回答