David, Take a look at these IBM links:
http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=168&thr ead=136143&cat=9 http://mail-archives.apache.org/mod_mbox/cocoon-dev/200309.mbox/%3C20030 [EMAIL PROTECTED] http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=17470 9&cat=10&thread=26484&treeDisplayType=expandtree&forum=176 The 1st link tells you that others have seen this issue outside of Jetspeed when using Pluto + Websphere and the 2nd & 3rd links perhaps might give you a clue as to the source of the problem. We're still grappling with why we should suddenly start seeing this issue under load. We're fairly certain that we haven't seen this issue in the past product releases (we put at least one of the previous releases under significant load to test these kind of issues). Yes catching the exception isn't a problem (we've done that as you'll notice in the code snippet I sent you in my previous post) - the issue is, if we can't identify the source of the problem, can we code defensively against it? That strategy will rely on catching the exception and then somehow recovering from it gracefully - returning null doesn't work. We don't have source code to the websphere method - but if we find more clues, we'll send them your way. Thanks, Raman -----Original Message----- From: David Sean Taylor [mailto:[EMAIL PROTECTED] Sent: Friday, January 26, 2007 2:53 PM To: Jetspeed Users List Subject: Re: NullPointerException when calling PortletURLImpl.toString() in websphere 6.0 Catching the runtime NPE is not a problem, try { String x = null; x.equals("throw"); } catch (NullPointerException npe) { System.out.println("npe = " + npe); } or catch anything catch (Throwable t) { System.out.println("NPE CAUGHT = " + t); } What is concerning me is *why* are we getting a NPE in the first place. Do you have the source code to the Websphere method where the NPE initiates? Tallamraju, Raman wrote: > Hi David, > > Woonsan's fix didn't help - the nullpointerexception was still being > thrown even after the exception is caught in > InformationProviderServiceImpl and a new provider is created. > > We tried your suggestion of returning null on error in getAttribute > method in ServletRequestImpl. We confirmed that name isn't null and that > an exception is thrown in the body of getAttribute method. Catching that > exception and returning null leads to an illegal state exception (stack > trace below). > > I'm attaching the modified code (for both ServletRequestImpl & > InformationProviderServiceImpl) and the new stack trace below. Do you > have any ideas on how we can change getAttribute method so it might > recover gracefully from the nullpointerexception? > > Thanks, > Raman > > CLASS: ServletRequestImpl.java > =============================== > > public Object getAttribute(String name) { > Object value = null; > > if (name == null) > { > log.info("***Caught the websphere > NullPointerException - NAME WAS NULL***"); > return value; > } > > try > { > value = super.getAttribute(name); > > if (name.equals(PortletRequest.USER_INFO)) { > JetspeedRequestContext context = > (JetspeedRequestContext) > getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE); > if (null != context) { > String entityID = "--NULL--"; > PortletEntity entity = > portletWindow.getPortletEntity(); > if (entity != null) { > entityID = > entity.getId().toString(); > } > PortletApplicationEntity > portletAppEntity = portletWindow > > .getPortletEntity().getPortletApplicationEntity(); > PortletApplicationDefinition > portletAppDef = entity > > .getPortletDefinition() > > .getPortletApplicationDefinition(); > > if (null != portletAppDef) { > value = > context.getUserInfoMap(portletAppDef.getId()); > if (log.isDebugEnabled() > && (null != value)) > > log.debug(PortletRequest.USER_INFO + " map size: " > > + ((Map) value).size()); > } else { > log.error("Entity is > null:" + entityID); > } > > } > } else { > if (null == value) { > PortletRequest pr = > (PortletRequest) super > > .getAttribute("javax.portlet.request"); > if (pr != null) { > value = > super.getAttribute(nameSpaceMapper.encode( > > portletWindow.getId(), name)); > } > } > } > } > catch (Exception e) { > log.info("***Caught the websphere > NullPointerException & recovered from it in ServletRequestImpl***"); > } > return value; > } > > > CLASS: InformationProviderServiceImpl.java > =========================================== > > public DynamicInformationProvider > getDynamicProvider(javax.servlet.http.HttpServletRequest request) > { > DynamicInformationProvider provider = null; > > try > { > provider = (DynamicInformationProvider) > request.getAttribute("org.apache.jetspeed.engine.core.DynamicInformation > Provider"); > } > catch (Exception e) > { > log.info("***Caught the websphere NullPointerException & > recovered from it***"); > } > > if (provider == null) > { > provider = new DynamicInformationProviderImpl(request, > servletConfig); > > request.setAttribute("org.apache.jetspeed.engine.core.DynamicInformation > Provider", provider); > } > > return provider; > } > > New StackTrace > =============== > > 2007-01-26 13:43:19,621 [WebContainer : 6] ERROR > org.apache.portals.gems.browser.BrowserPortlet - Exception > java.lang.IllegalStateException: Cannot call > getRequestContext(HttpServletRequest request) before it has been created > and set for this thread. > at > org.apache.jetspeed.request.JetspeedRequestContextComponent.getRequestCo > ntext(JetspeedRequestContextComponent.java(Inlined Compiled Code)) > at > org.apache.jetspeed.services.information.DynamicInformationProviderImpl. > <init>(DynamicInformationProviderImpl.java(Inlined Compiled Code)) > at > org.apache.jetspeed.services.information.InformationProviderServiceImpl. > getDynamicProvider(InformationProviderServiceImpl.java(Inlined Compiled > C\ > ode)) > at > org.apache.pluto.services.information.InformationProviderAccess.getDynam > icProvider(InformationProviderAccess.java(Inlined Compiled Code)) > at > org.apache.pluto.core.impl.PortletURLImpl.toString(PortletURLImpl.java(C > ompiled Code)) > at > org.apache.jetspeed.container.url.impl.JetspeedPortletURL.toString(Jetsp > eedPortletURL.java(Compiled Code)) > at > com.fmr.fimt.bosportal.portlet.portletinventory.PortletInventory.getRows > (PortletInventory.java(Compiled Code)) > at > com.fmr.fimt.bosportal.portlet.selector.PortletSelector.getRows(PortletS > elector.java:215) > at > org.apache.portals.gems.browser.BrowserPortlet.doView(BrowserPortlet.jav > a:188) > at > com.fmr.fimt.bosportal.portlet.selector.PortletSelector.doView(PortletSe > lector.java:130) > at > com.fmr.fimt.bosportal.portlet.portletinventory.PortletInventory.doView( > PortletInventory.java:236) > at > javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java(Compiled > Code)) > at > javax.portlet.GenericPortlet.render(GenericPortlet.java(Compiled Code)) > at > org.apache.portals.bridges.velocity.GenericVelocityPortlet.render(Generi > cVelocityPortlet.java:163) > at > org.apache.jetspeed.factory.JetspeedPortletInstance.render(JetspeedPortl > etInstance.java(Compiled Code)) > at > org.apache.jetspeed.container.JetspeedContainerServlet.doGet(JetspeedCon > tainerServlet.java(Compiled Code)) > at > org.apache.jetspeed.container.JetspeedContainerServlet.doPost(JetspeedCo > ntainerServlet.java(Compiled Code)) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja > va(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap > per.java(Compiled Code)) > at > com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppReq > uestDispatcher.java(Compiled Code)) > at > org.apache.jetspeed.container.invoker.ServletPortletInvoker.invoke(Servl > etPortletInvoker.java(Compiled Code)) > at > org.apache.jetspeed.container.invoker.ServletPortletInvoker.render(Servl > etPortletInvoker.java(Compiled Code)) > at > org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerImpl > .java(Compiled Code)) > at > org.apache.jetspeed.container.JetspeedPortletContainerWrapper.renderPort > let(JetspeedPortletContainerWrapper.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute(RenderingJo > bImpl.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.PortletRendererImpl.renderNow(Portle > tRendererImpl.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRende > r(PageAggregatorImpl.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRende > r(PageAggregatorImpl.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.aggregateAndRende > r(PageAggregatorImpl.java(Compiled Code)) > at > org.apache.jetspeed.aggregator.impl.PageAggregatorImpl.build(PageAggrega > torImpl.java:106) > at > org.apache.jetspeed.aggregator.AggregatorValve.invoke(AggregatorValve.ja > va:48) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.decoration.DecorationValve.invoke(DecorationValve.ja > va:110) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl.invoke(ActionVal > veImpl.java:147) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Inlined Compiled Code)) > at > com.fmr.fimt.fw.pipeline.valve.impl.UsageStatsValveImpl.invoke(UsageStat > sValveImpl.java(Compiled Code)) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.container.ContainerValve.invoke(ContainerValve.java: > 76) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.profiler.impl.ProfilerValveImpl.invoke(ProfilerValve > Impl.java:255) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.security.impl.LoginValidationValveImpl.invoke(LoginV > alidationValveImpl.java:159) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.localization.impl.LocalizationValveImpl.invoke(Local > izationValveImpl.java:169) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.security.impl.AbstractSecurityValve$1.run(AbstractSe > curityValve.java:117) > at java.security.AccessController.doPrivileged1(Native Method) > at > java.security.AccessController.doPrivileged(AccessController.java(Compil > ed Code)) > at > javax.security.auth.Subject.doAsPrivileged(Subject.java(Compiled Code)) > at > org.apache.jetspeed.security.impl.AbstractSecurityValve.invoke(AbstractS > ecurityValve.java:111) > at > com.fmr.portal.security.NTLMSecurityValve.invoke(NTLMSecurityValve.java: > 216) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.container.url.impl.PortalURLValveImpl.invoke(PortalU > RLValveImpl.java:67) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.capabilities.impl.CapabilityValveImpl.invoke(Capabil > ityValveImpl.java:128) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > com.fmr.fimt.fw.pipeline.valve.impl.StatisticsValveImpl.invoke(Statistic > sValveImpl.java:57) > at > org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(Jets > peedPipeline.java(Compiled Code)) > at > org.apache.jetspeed.pipeline.JetspeedPipeline.invoke(JetspeedPipeline.ja > va:145) > at > org.apache.jetspeed.engine.JetspeedEngine.service(JetspeedEngine.java:21 > 4) > at > org.apache.jetspeed.engine.JetspeedServlet.doGet(JetspeedServlet.java:23 > 8) > at > org.apache.jetspeed.engine.JetspeedServlet.doPost(JetspeedServlet.java:2 > 65) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja > va(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja > va(Compiled Code)) > at > com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh > ain.java(Compiled Code)) > at > com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterC > hain.java(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap > per.java(Compiled Code)) > at > com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheS > ervletWrapper.java:80) > at > com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:180 > 2) > at > com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:8 > 4) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminatio > n(HttpInboundLink.java:469) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformatio > n(HttpInboundLink.java:408) > at > com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpIC > LReadCallback.java:101) > at > com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallba > ck.complete(SSLReadServiceContext.java:1686) > at > com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueMa > nager.java:566) > at > com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager. > java(Compiled Code)) > at > com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager. > java:952) > at > com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager > .java:1039) > at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455) > > -----Original Message----- > From: David Sean Taylor [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 25, 2007 8:36 PM > To: Jetspeed Users List > Subject: Re: NullPointerException when calling PortletURLImpl.toString() > in websphere 6.0 > > > > Tallamraju, Raman wrote: >> The actual code snippet is >> this: >> >> /** >> * @see >> javax.servlet.http.HttpServletRequest#getAttribute(java.lang.String) >> */ >> public Object getAttribute( String name ) >> { >> ***Object value = super.getAttribute(name);***(Line 210) > > Could this be caused by "name == null"? > If so, I can add a check for > > if (name == null) > return null; > > and bypass making the super call > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- David Sean Taylor Bluesunrise Software [EMAIL PROTECTED] [office] +01 707 773-4646 [mobile] +01 707 529 9194 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
