[jboss-user] [JBoss Portal] - org.jboss.portal.portlet.container.PortletInitializationExc

hussain_rangwala do-not-reply at jboss.com
Wed Jan 17 00:08:43 EST 2007


hey peter
            i am facing the same problem....i am getting this exception when i m trying to deploy my application as a portlet on Jboss portal 2.4.0.GA.


  | 2007-01-17 09:54:59,343 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=portal:container=Portlet,id=SETLAppName.SETLPortletName state=Create
  | org.jboss.portal.portlet.container.PortletInitializationException: The portlet SETLPortletName threw a runtime exception during init
  | 	at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:287)
  | 	at org.jboss.portal.portlet.container.PortletContainerAdapter.start(PortletContainerAdapter.java:74)
  | 	at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.joinpoint.plugins.reflect.ReflectMethodJoinPoint.dispatch(ReflectMethodJoinPoint.java:72)
  | 	at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:92)
  | 	at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:452)
  | 	at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:147)
  | 	at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
  | 	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
  | 	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
  | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
  | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
  | 	at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:74)
  | 	at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:232)
  | 	at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:79)
  | 	at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfo$DeploymentContext.start(PortalDeploymentInfo.java:211)
  | 	at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:242)
  | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy107.deploy(Unknown Source)
  | 	at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:296)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy82.deploy(Unknown Source)
  | 	at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:54)
  | 	at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:133)
  | 	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
  | 	at $Proxy108.handleNotification(Unknown Source)
  | 	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
  | 	at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
  | 	at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
  | 	at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
  | 	at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
  | 	at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
  | 	at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117)
  | 	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
  | 	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy86.start(Unknown Source)
  | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
  | 	at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy8.deploy(Unknown Source)
  | 	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  | 	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
  | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  | 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  | 	at $Proxy0.start(Unknown Source)
  | 	at org.jboss.system.ServiceController.start(ServiceController.java:417)
  | 	at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy4.start(Unknown Source)
  | 	at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
  | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy5.deploy(Unknown Source)
  | 	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
  | 	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
  | 	at org.jboss.Main.boot(Main.java:200)
  | 	at org.jboss.Main$1.run(Main.java:464)
  | 	at java.lang.Thread.run(Thread.java:595)
  | Caused by: java.lang.ClassCastException: org.apache.portals.bridges.struts.StrutsPortlet
  | 	at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:249)
  | 

StrutsPortlet.class included in the portal-bridges-struts-1.2.4-1.0

  | package org.apache.portals.bridges.struts;
  | 
  | import java.io.IOException;
  | import java.io.PrintWriter;
  | import javax.portlet.*;
  | import javax.servlet.*;
  | import javax.servlet.http.*;
  | import org.apache.commons.logging.Log;
  | import org.apache.commons.logging.LogFactory;
  | import org.apache.portals.bridges.common.ServletContextProvider;
  | import org.apache.portals.bridges.struts.config.RenderContextAttributes;
  | import org.apache.portals.bridges.struts.config.StrutsPortletConfig;
  | import org.apache.portals.bridges.struts.util.EmptyHttpServletResponseWrapper;
  | 
  | // Referenced classes of package org.apache.portals.bridges.struts:
  | //            StrutsPortletErrorContext, PortletServletRequestWrapper, StrutsPortletURL
  | 
  | public class StrutsPortlet extends GenericPortlet
  | {
  | 
  |     public StrutsPortlet()
  |     {
  |         defaultActionPage = null;
  |         defaultCustomPage = null;
  |         defaultEditPage = null;
  |         defaultHelpPage = null;
  |         defaultViewPage = null;
  |     }
  | 
  |     public void init(PortletConfig config)
  |         throws PortletException
  |     {
  |         super.init(config);
  |         String contextProviderClassName = getContextProviderClassNameParameter(config);
  |         if(contextProviderClassName == null)
  |             throw new PortletException("Portlet " + config.getPortletName() + " is incorrectly configured. Init parameter " + "ServletContextProvider" + " not specified");
  |         if(contextProviderClassName != null)
  |             try
  |             {
  |                 Class clazz = Class.forName(contextProviderClassName);
  |                 if(clazz != null)
  |                 {
  |                     Object obj = clazz.newInstance();
  |                     if((org.apache.portals.bridges.common.ServletContextProvider.class).isInstance(obj))
  |                         servletContextProvider = (ServletContextProvider)obj;
  |                     else
  |                         throw new PortletException("class not found");
  |                 }
  |             }
  |             catch(Exception e)
  |             {
  |                 if(e instanceof PortletException)
  |                 {
  |                     throw (PortletException)e;
  |                 } else
  |                 {
  |                     e.printStackTrace();
  |                     throw new PortletException("Cannot load", e);
  |                 }
  |             }
  |         if(servletContextProvider == null)
  |             throw new PortletException("Portlet " + config.getPortletName() + " is incorrectly configured. Invalid init parameter " + "ServletContextProvider" + " value " + contextProviderClassName);
  |         defaultActionPage = getActionPageParameter(config);
  |         defaultCustomPage = getCustomPageParameter(config);
  |         defaultEditPage = getEditPageParameter(config);
  |         defaultViewPage = getViewPageParameter(config);
  |         defaultHelpPage = getHelpPageParameter(config);
  |         if(defaultViewPage == null)
  |             throw new PortletException("Portlet " + config.getPortletName() + " is incorrectly configured. No default View page is defined.");
  |         if(defaultActionPage == null)
  |             defaultActionPage = defaultViewPage;
  |         if(defaultCustomPage == null)
  |             defaultCustomPage = defaultViewPage;
  |         if(defaultHelpPage == null)
  |             defaultHelpPage = defaultViewPage;
  |         if(defaultEditPage == null)
  |             defaultEditPage = defaultViewPage;
  |         strutsPortletConfig = new StrutsPortletConfig();
  |         String strutsPortletConfigLocation = getStrutsPortletConfigLocationParameter(config);
  |         if(strutsPortletConfigLocation == null)
  |             strutsPortletConfigLocation = "WEB-INF/struts-portlet-config.xml";
  |         strutsPortletConfig.loadConfig(config.getPortletContext(), strutsPortletConfigLocation);
  |         config.getPortletContext().setAttribute("org.apache.portals.bridges.struts.portlet_config", strutsPortletConfig);
  |     }
  | 
  |     protected String getContextProviderClassNameParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("ServletContextProvider");
  |     }
  | 
  |     protected ServletContextProvider getServletContextProvider()
  |     {
  |         return servletContextProvider;
  |     }
  | 
  |     protected ServletContext getServletContext(GenericPortlet portlet, PortletRequest request, PortletResponse response)
  |     {
  |         return getServletContextProvider().getServletContext(portlet);
  |     }
  | 
  |     protected HttpServletRequest getHttpServletRequest(GenericPortlet portlet, PortletRequest request, PortletResponse response)
  |     {
  |         return getServletContextProvider().getHttpServletRequest(portlet, request);
  |     }
  | 
  |     protected HttpServletResponse getHttpServletResponse(GenericPortlet portlet, PortletRequest request, PortletResponse response)
  |     {
  |         return getServletContextProvider().getHttpServletResponse(portlet, response);
  |     }
  | 
  |     protected String getStrutsPageURL(PortletRequest request)
  |     {
  |         return request.getParameter("_spage");
  |     }
  | 
  |     protected String getStrutsOriginURL(PortletRequest request)
  |     {
  |         return request.getParameter("_sorig");
  |     }
  | 
  |     protected String getActionPageParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("ActionPage");
  |     }
  | 
  |     protected String getCustomPageParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("CustomPage");
  |     }
  | 
  |     protected String getEditPageParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("EditPage");
  |     }
  | 
  |     protected String getViewPageParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("ViewPage");
  |     }
  | 
  |     protected String getHelpPageParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("HelpPage");
  |     }
  | 
  |     protected String getStrutsPortletConfigLocationParameter(PortletConfig config)
  |     {
  |         return config.getInitParameter("StrutsPortletConfigLocation");
  |     }
  | 
  |     public void doEdit(RenderRequest request, RenderResponse response)
  |         throws PortletException, IOException
  |     {
  |         processRequest(request, response, defaultEditPage, "EDIT");
  |     }
  | 
  |     public void doHelp(RenderRequest request, RenderResponse response)
  |         throws PortletException, IOException
  |     {
  |         processRequest(request, response, defaultHelpPage, "HELP");
  |     }
  | 
  |     public void doCustom(RenderRequest request, RenderResponse response)
  |         throws PortletException, IOException
  |     {
  |         processRequest(request, response, defaultCustomPage, "CUSTOM");
  |     }
  | 
  |     public void doView(RenderRequest request, RenderResponse response)
  |         throws PortletException, IOException
  |     {
  |         processRequest(request, response, defaultViewPage, "VIEW");
  |     }
  | 
  |     public void processAction(ActionRequest request, ActionResponse response)
  |         throws PortletException, IOException
  |     {
  |         processRequest(request, response, defaultActionPage, "ACTION");
  |     }
  | 
  |     protected void processRequest(PortletRequest request, PortletResponse response, String defaultPage, String requestType)
  |         throws PortletException, IOException
  |     {
  |         ServletContext servletContext = getServletContext(this, request, response);
  |         HttpServletRequest req = getHttpServletRequest(this, request, response);
  |         HttpServletResponse res = getHttpServletResponse(this, request, response);
  |         HttpSession session = req.getSession();
  |         String portletName = getPortletConfig().getPortletName();
  |         req.setAttribute("org.apache.portals.bridges.struts.portlet_name", portletName);
  |         boolean actionRequest = request instanceof ActionRequest;
  |         StrutsPortletErrorContext errorContext;
  |         String keepRenderAttributes;
  |         String path;
  |         String pageURL;
  |         RequestDispatcher rd;
  |         String origin;
  |         ServletException e;
  |         String renderURL;
  |         IllegalStateException ise;
  |         try
  |         {
  |             errorContext = (StrutsPortletErrorContext)req.getSession().getAttribute("org.apache.portals.bridges.struts.error_context_" + portletName);
  |             if(errorContext != null)
  |             {
  |                 if(!actionRequest)
  |                 {
  |                     req.getSession().removeAttribute("org.apache.portals.bridges.struts.error_context_" + portletName);
  |                     renderError(res, errorContext);
  |                 }
  |                 return;
  |             }
  |         }
  |         catch(IOException e)
  |         {
  |             if(log.isErrorEnabled())
  |                 log.error("unexpected", e);
  |             throw e;
  |         }
  |         keepRenderAttributes = null;
  |         if(!actionRequest)
  |             keepRenderAttributes = request.getParameter("_kra");
  |         if(keepRenderAttributes == null)
  |             strutsPortletConfig.getRenderContextAttributes().clearAttributes(session);
  |         else
  |             strutsPortletConfig.getRenderContextAttributes().restoreAttributes(req);
  |         path = null;
  |         pageURL = getStrutsPageURL(request);
  |         if(pageURL == null)
  |             path = defaultPage;
  |         else
  |             path = pageURL;
  |         if(log.isDebugEnabled())
  |             log.debug("process path: " + path + ", requestType: " + requestType);
  |         rd = servletContext.getRequestDispatcher(path);
  |         if(rd != null)
  |         {
  |             if(actionRequest)
  |             {
  |                 res = new EmptyHttpServletResponseWrapper(res);
  |                 if(req.getAttribute("javax.portlet.config") == null)
  |                     req.setAttribute("javax.portlet.config", getPortletConfig());
  |                 if(req.getAttribute("javax.portlet.request") == null)
  |                     req.setAttribute("javax.portlet.request", request);
  |                 if(req.getAttribute("javax.portlet.response") == null)
  |                     req.setAttribute("javax.portlet.response", response);
  |                 origin = getStrutsOriginURL(request);
  |                 if(origin == null)
  |                     origin = defaultPage;
  |                 request.setAttribute("org.apache.portals.bridges.struts.origin_url", origin);
  |             }
  |             if(path != null)
  |                 req.setAttribute("org.apache.portals.bridges.struts.page_url", path);
  |             req.setAttribute("org.apache.portals.bridges.struts.request_type", requestType);
  |             try
  |             {
  |                 rd.include(new PortletServletRequestWrapper(servletContext, req), res);
  |             }
  |             // Misplaced declaration of an exception variable
  |             catch(ServletException e)
  |             {
  |                 if(log.isErrorEnabled())
  |                     log.error("Include exception", e);
  |                 errorContext = new StrutsPortletErrorContext();
  |                 errorContext.setError(e);
  |                 req.setAttribute("org.apache.portals.bridges.struts.error_context", errorContext);
  |                 if(!actionRequest)
  |                     renderError(res, errorContext);
  |             }
  |             if(actionRequest)
  |                 if(req.getAttribute("org.apache.portals.bridges.struts.error_context") != null)
  |                 {
  |                     pageURL = StrutsPortletURL.getOriginURL(req);
  |                     if(pageURL != null)
  |                         ((ActionResponse)response).setRenderParameter("_spage", pageURL);
  |                     if(log.isDebugEnabled())
  |                         log.debug("action render error context");
  |                     try
  |                     {
  |                         req.getSession(true).setAttribute("org.apache.portals.bridges.struts.error_context_" + portletName, req.getAttribute("org.apache.portals.bridges.struts.error_context"));
  |                     }
  |                     // Misplaced declaration of an exception variable
  |                     catch(IllegalStateException ise) { }
  |                 } else
  |                 if((renderURL = (String)req.getAttribute("org.apache.portals.bridges.struts.redirect_url")) != null)
  |                 {
  |                     if(log.isDebugEnabled())
  |                         log.debug("action send redirect: " + renderURL);
  |                     ((ActionResponse)response).sendRedirect(renderURL);
  |                 } else
  |                 {
  |                     strutsPortletConfig.getRenderContextAttributes().saveAttributes(req);
  |                     ((ActionResponse)response).setRenderParameter("_kra", "1");
  |                     if((renderURL = (String)req.getAttribute("org.apache.portals.bridges.struts.redirect_page_url")) != null)
  |                     {
  |                         if(log.isDebugEnabled())
  |                             log.debug("action render redirected page: " + renderURL);
  |                         pageURL = renderURL;
  |                     }
  |                     if(pageURL != null)
  |                     {
  |                         if(renderURL == null && log.isWarnEnabled())
  |                             log.warn("Warning: Using the original action URL for render URL: " + pageURL + ".\nA redirect should have been issued.");
  |                         ((ActionResponse)response).setRenderParameter("_spage", pageURL);
  |                     }
  |                 }
  |         }
  |     }
  | 
  |     protected void renderError(HttpServletResponse response, StrutsPortletErrorContext errorContext)
  |         throws IOException
  |     {
  |         PrintWriter writer = response.getWriter();
  |         writer.println("<hr/><h2>Error</h2>");
  |         writer.println("<table border='1'>");
  |         if(errorContext.getErrorCode() != 0)
  |             writer.println("<tr><td valign='top'><b>Error Code</b></td><td>" + errorContext.getErrorCode() + "</td></tr>");
  |         if(errorContext.getErrorMessage() != null)
  |             writer.println("<tr><td valign='top'><b>Error Message</b></td><td>" + errorContext.getErrorMessage() + "</td></tr>");
  |         if(errorContext.getError() != null)
  |         {
  |             Throwable e = errorContext.getError();
  |             if((e instanceof ServletException) && ((ServletException)e).getRootCause() != null)
  |                 e = ((ServletException)e).getRootCause();
  |             writer.print("<tr><td valign='top'><b>Error</b></td><td>" + e.getMessage() + "</td></tr>");
  |             writer.print("<tr><td valign='top'><b>Error Type</b></td><td>" + e.getClass().getName() + "</td></tr>");
  |             writer.print("<tr><td valign='top'><b>Stacktrace</b></td><td>");
  |             StackTraceElement elements[] = e.getStackTrace();
  |             StringBuffer buf = new StringBuffer();
  |             for(int i = 0; i < elements.length; i++)
  |                 buf.append("  " + elements.toString() + "<br>");
  | 
  |             writer.print(buf.toString());
  |             writer.println("</td></tr>");
  |         }
  |         writer.println("</table>");
  |     }
  | 
  |     public static final String PARAM_SERVLET_CONTEXT_PROVIDER = "ServletContextProvider";
  |     public static final String STRUTS_PORTLET_CONFIG_LOCATION = "StrutsPortletConfigLocation";
  |     public static final String PARAM_ACTION_PAGE = "ActionPage";
  |     public static final String PARAM_CUSTOM_PAGE = "CustomPage";
  |     public static final String PARAM_EDIT_PAGE = "EditPage";
  |     public static final String PARAM_HELP_PAGE = "HelpPage";
  |     public static final String PARAM_VIEW_PAGE = "ViewPage";
  |     private String defaultActionPage;
  |     private String defaultCustomPage;
  |     private String defaultEditPage;
  |     private String defaultHelpPage;
  |     private String defaultViewPage;
  |     private ServletContextProvider servletContextProvider;
  |     private static final Log log;
  |     public static final String REQUEST_TYPE = "org.apache.portals.bridges.struts.request_type";
  |     public static final String PAGE_URL = "org.apache.portals.bridges.struts.page_url";
  |     public static final String ORIGIN_URL = "org.apache.portals.bridges.struts.origin_url";
  |     public static final String REDIRECT_PAGE_URL = "org.apache.portals.bridges.struts.redirect_page_url";
  |     public static final String REDIRECT_URL = "org.apache.portals.bridges.struts.redirect_url";
  |     public static final String RENDER_CONTEXT = "org.apache.portals.bridges.struts.render_context";
  |     public static final String ERROR_CONTEXT = "org.apache.portals.bridges.struts.error_context";
  |     public static final String PORTLET_NAME = "org.apache.portals.bridges.struts.portlet_name";
  |     public static final String STRUTS_PORTLET_CONFIG = "org.apache.portals.bridges.struts.portlet_config";
  |     public static final String DEFAULT_STRUTS_PORTLET_CONFIG_LOCATION = "WEB-INF/struts-portlet-config.xml";
  |     public static final String ACTION_REQUEST = "ACTION";
  |     public static final String VIEW_REQUEST = "VIEW";
  |     public static final String CUSTOM_REQUEST = "CUSTOM";
  |     public static final String EDIT_REQUEST = "EDIT";
  |     public static final String HELP_REQUEST = "HELP";
  |     private StrutsPortletConfig strutsPortletConfig;
  | 
  |     static 
  |     {
  |         log = LogFactory.getLog(org.apache.portals.bridges.struts.StrutsPortlet.class);
  |     }
  | }
  | 

Any ideas and suggestions would be of great help........Kindly reply as soon as possible

Thanks
Hussain

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002581#4002581

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002581



More information about the jboss-user mailing list