Я полностью погуглил эту тему и включил уровень отладки для 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, и это все.