Hi Matt,
I get the below exception on my console, kindly let me know what could be the
problem.
Failure initializing struts-menu: Error parsing resource file:
/WEB-INF/menu-config.xml nested exception is: InputStream to parse is null
--- On Fri, 4/17/09, Jayaram Gokulan <karam...@yahoo.com> wrote:
From: Jayaram Gokulan <karam...@yahoo.com>
Subject: Re: [struts-menu] Struts 2 dynamic menu issue
To: "General mailing list for Struts Menu"
<struts-menu-user@lists.sourceforge.net>
Date: Friday, April 17, 2009, 9:06 AM
Hi Matt,
Need help on this
I set the repository in my Action as below
package gov.mn.commerce.eassessment.security.action;
import gov.mn.commerce.eassessment.framework.action.BaseAction;
import gov.mn.commerce.eassessment.security.model.BusinessFunction;
import gov.mn.commerce.eassessment.security.model.Roles;
import gov.mn.commerce.eassessment.security.model.UserProfile;
import gov.mn.commerce.eassessment.security.service.AuthorizationManager;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.servlet.http.Cookie;
import javax.servlet.jsp.JspException;
import net.sf.navigator.displayer.DropDownMenuDisplayer;
import net.sf.navigator.displayer.MenuDisplayer;
import net.sf.navigator.displayer.MenuDisplayerMapping;
import net.sf.navigator.menu.MenuComponent;
import net.sf.navigator.menu.MenuRepository;
import com.opensymphony.xwork2.Preparable;
public class AuthorizationAction extends BaseAction implements Preparable {
/**
*
*/
private static final long serialVersionUID = 1L;
public AuthorizationManager authorizationManager;
public void prepare() {
}
/**
* To get the Menu structure and values from the table, adn setting values
* into session
*
* @return String
*/
public String getUserBusinessfunctions()throws JspException,IOException {
UserProfile user = null;
if (getCurrentUser() != null) {
user = getCurrentUser();
log.debug("::::::::::Current UserprofileId:::::::::"
+ user.getUserProfileId());
}
Long domainid=(Long)getSession().getAttribute("domainid");
if(domainid!=null)
{
Cookie cookie=new Cookie("domainid",domainid.toString());
getResponse().addCookie(cookie);
}
if (getCurrentUser() != null) {
Set<Roles> roles=getCurrentUser().getRoles();
Map<Long,BusinessFunction> businessFunctionList=new TreeMap<Long,
BusinessFunction>();
for(Roles roles2:roles)
{
for(BusinessFunction businessFunction:roles2.getBusinessFunctions())
{
if(!businessFunctionList.containsKey(businessFunction.getFunctionId()))
businessFunctionList.put(businessFunction.getFunctionId(), businessFunction);
}
}
MenuRepository repository = new MenuRepository();
LinkedHashMap displayerList=new LinkedHashMap();
List<Long> keys=new ArrayList<Long>(businessFunctionList.keySet());
for(int i=0;i<businessFunctionList.size();i++)
{
MenuComponent menuComponent=new MenuComponent();
log.error(businessFunctionList.size());
log.error(keys.get(i));
menuComponent.setName(businessFunctionList.get(keys.get(i)).getName());
MenuComponent parentmenu=new MenuComponent();
parentmenu.setName(businessFunctionList.get((businessFunctionList.get(keys.get(i))).getFunctionId()).getName());
menuComponent.setParent(parentmenu);
menuComponent.setLocation(businessFunctionList.get(keys.get(i)).getUrl());
menuComponent.setTitle(businessFunctionList.get(keys.get(i)).getName());
repository.addMenu(menuComponent);
DropDownMenuDisplayer displayer=new DropDownMenuDisplayer();
displayer.display(menuComponent);
displayerList.put(keys.get(i),displayer);
}
// repository.setDisplayers(displayerList);
getSession().setAttribute("repository",repository);
}
return "mainMenu";
}
public AuthorizationManager getAuthorizationManager() {
return authorizationManager;
}
public void setAuthorizationManager(
AuthorizationManager authorizationManager) {
this.authorizationManager = authorizationManager;
}
}
My menu.jsp
<@page import="net.sf.navigator.displayer.MenuDisplayer",
"net.sf.navigator.displayer.MenuDisplayerMapping"/>
<menu:useMenuDisplayer name="Velocity" config="/templates/xtree.html"
repository="repository">
<c:forEach var="menu" items="${repository.topMenus}">
<menu-el:displayMenu name="${menu.name}" />
</c:forEach>
</menu:useMenuDisplayer>
I get the below exception
[4/17/09 19:35:27:125 IST] 00000059 SystemErr R
java.lang.IllegalArgumentException: InputStream to parse is null
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
org.apache.commons.digester.Digester.parse(Digester.java:1882)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
net.sf.navigator.menu.MenuRepository.load(MenuRepository.java:202)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
net.sf.navigator.menu.MenuContextListener.contextInitialized(MenuContextListener.java:62)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:652)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:355)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:292)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:92)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:671)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:624)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1138)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startModule(ApplicationMgrImpl.java:1744)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.runtime.component.ApplicationMgrImpl._startModule(ApplicationMgrImpl.java:1692)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
java.lang.reflect.Method.invoke(Method.java:615)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.misc.Trampoline.invoke(MethodUtil.java:62)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
java.lang.reflect.Method.invoke(Method.java:615)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:265)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1089)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:971)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:231)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:238)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1106)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:999)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:196)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.StartDeploymentTask.fineGrainUpdate(StartDeploymentTask.java:149)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:79)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.AppBinaryProcessor$AppBinThread.run(AppBinaryProcessor.java:1057)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcess(AppBinaryProcessor.java:669)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.AppBinaryProcessor._onChangeCompletion(AppBinaryProcessor.java:477)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.AppBinaryProcessor$2.run(AppBinaryProcessor.java:438)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.sync.AppBinaryProcessor.onChangeCompletion(AppBinaryProcessor.java:425)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1761)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1306)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:637)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1858)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1805)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:479)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.task.ConfigRepoHelper.removeWorkSpace(ConfigRepoHelper.java:158)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.SchedulerImpl.cleanup(SchedulerImpl.java:378)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
com.ibm.ws.management.application.SchedulerImpl.run(SchedulerImpl.java:284)
[4/17/09 19:35:27:203 IST] 00000059 SystemErr R at
java.lang.Thread.run(Thread.java:797)
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
-----Inline Attachment Follows-----
_______________________________________________
struts-menu-user mailing list
struts-menu-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/struts-menu-user
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
struts-menu-user mailing list
struts-menu-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/struts-menu-user