- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们将 IBM WebSphere Portal 与 JSF
结合使用。 可怕的组合,一次又一次地证明它的可怕。
最近我们遇到了一个问题,我们有一个带有 链接 到 下载 servlet 的 portlet(包含在 same war 中) .此 servlet 尝试从 HttpSession 读取某些属性,这些属性应该由 portlet 在 <APPLICATION_SCOPE
中的 em>PortletSession。
但有时,servlet 无法读取 HttpSession
中的任何所需属性。这是我进行调查的原因。经过一番搜索后,我发现它只发生在 portlet 被第一次加载(没有任何页面重新加载)。
经过一些实验后,我在 PortletSession
上调用 getAttributeNames(scope)
时得到了一个 NullPointerException
。 PortletSession
是通过faces 上下文 从外部上下文 获得的。我发现 PortletSession
实际上是一个 com.ibm.faces.portlet.httpbridge.PortletSessionWrapper
显然 应该包含 实际的 PortletSession
。此包含的 session 显然是空。 PortletSessionWrapper
的大多数方法通过空检查来防止 NPE,但是,getAttributeNames(scope)
没有(如果你问我)。
现在是个大问题:为什么 上的(真实的)PortletSession
null portlet 的首次加载 ?
提供包装器的 jsf-protletbrdige 的 META-INF
:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: IBM Corporation
Specification-Title: Java Server Faces
Implementation-Title: JSF Widget Library (JWL) - Portlet Bridge
Implementation-Version: JWL v3_1_5
Implementation-Vendor: IBM
Build-Version: 20100212_0941
Build-Date: February 12 2010
Copyright-Info: Copyright (c) 2003,2008, International Business Machines Corporation. All Rights Reserved.
调用 getAttributeNames(scope) 方法时的堆栈跟踪:
[21-8-12 17:52:16:051 CEST] 00000041 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet Header in application PA_mytestportlet. Exception created : javax.servlet.ServletException: javax.portlet.PortletException: /MyPortletView.jsp(105,9) '#{MyPortletView.productId}' Error reading 'productId' on type mytest.portal.testportlet.view.MyPortletViewBean
at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.doDispatch(PortletServlet.java:361)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:82)
at com.ibm.isclite.container.collaborator.PortletServletCollaborator.doDispatch(PortletServletCollaborator.java:143)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:74)
at com.ibm.ws.portletcontainer.rrd.RRDServerPortletServletCollaborator.doDispatch(RRDServerPortletServletCollaborator.java:60)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:74)
at com.ibm.ws.portletcontainer.cache.CacheCollaborator.doDispatch(CacheCollaborator.java:74)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:74)
at com.ibm.wps.pe.pc.waspc.core.impl.PortletServletCollaboratorImpl.doDispatch(PortletServletCollaboratorImpl.java:121)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:74)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.dispatch(PortletServlet.java:208)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.service(PortletServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.portletcontainer.webextension.PortletExtensionProcessor.handleRequest(PortletExtensionProcessor.java:86)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.ws.portletcontainer.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:214)
at com.ibm.ws.portletcontainer.invoker.impl.PortletInvokerCollaboratorChainImpl.doCollaborator(PortletInvokerCollaboratorChainImpl.java:78)
at com.ibm.ws.portletcontainer.cache.PortletInvokerCacheCollaborator.doRender(PortletInvokerCacheCollaborator.java:58)
at com.ibm.ws.portletcontainer.invoker.impl.PortletInvokerCollaboratorChainImpl.doCollaborator(PortletInvokerCollaboratorChainImpl.java:67)
at com.ibm.ws.portletcontainer.ext.PortletInvokerPerformanceCollaborator.invoke(PortletInvokerPerformanceCollaborator.java:313)
at com.ibm.ws.portletcontainer.ext.PortletInvokerPerformanceCollaborator.doInvoke(PortletInvokerPerformanceCollaborator.java:101)
at com.ibm.ws.portletcontainer.ext.PortletInvokerPerformanceCollaborator.invokePMI(PortletInvokerPerformanceCollaborator.java:163)
at com.ibm.ws.portletcontainer.ext.PortletInvokerPerformanceCollaborator.doInvoke(PortletInvokerPerformanceCollaborator.java:91)
at com.ibm.ws.portletcontainer.ext.PortletInvokerPerformanceCollaborator.doRender(PortletInvokerPerformanceCollaborator.java:74)
at com.ibm.ws.portletcontainer.invoker.impl.PortletInvokerCollaboratorChainImpl.doCollaborator(PortletInvokerCollaboratorChainImpl.java:67)
at com.ibm.ws.portletcontainer.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:97)
at com.ibm.ws.portletcontainer.PortletContainerImpl.doRender(PortletContainerImpl.java:121)
at com.ibm.ws.portletcontainer.PortletContainerInvokerCollaboratorChainImpl.doCollaborator(PortletContainerInvokerCollaboratorChainImpl.java:80)
at com.ibm.ws.portletcontainer.ext.ExtCollaborator.doRender(ExtCollaborator.java:74)
at com.ibm.ws.portletcontainer.PortletContainerInvokerCollaboratorChainImpl.doCollaborator(PortletContainerInvokerCollaboratorChainImpl.java:67)
at com.ibm.ws.portletcontainer.cache.CacheInvokerCollaborator.doRender(CacheInvokerCollaborator.java:66)
at com.ibm.ws.portletcontainer.PortletContainerInvokerCollaboratorChainImpl.doCollaborator(PortletContainerInvokerCollaboratorChainImpl.java:67)
at com.ibm.ws.portletcontainer.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:91)
at com.ibm.ws.portletcontainer.pcinvoker.PortletInvokerImpl$2.run(PortletInvokerImpl.java:100)
at java.security.AccessController.doPrivileged(AccessController.java:251)
at com.ibm.ws.portletcontainer.pcinvoker.PortletInvokerImpl.invokeRender(PortletInvokerImpl.java:96)
at com.ibm.wps.pe.pc.waspc.core.impl.PortletInvokerImpl$1.invoke(PortletInvokerImpl.java:98)
at com.ibm.wps.pe.pc.waspc.core.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:181)
at com.ibm.wps.pe.pc.waspc.core.impl.PortletInvokerImpl.invokeRender(PortletInvokerImpl.java:96)
at com.ibm.wps.pe.pc.waspc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:116)
at com.ibm.wps.pe.pc.PortletContainerImpl.doRenderPortlet(PortletContainerImpl.java:641)
at com.ibm.wps.pe.ext.render.AbstractRenderManager.performService(AbstractRenderManager.java:264)
at com.ibm.wps.pe.pc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:132)
at com.ibm.wps.engine.tags.PortletRenderTag.doStartTag(PortletRenderTag.java:179)
at com.ibm._jsp._Control._jspx_meth_portal$1skin_portletRender_0(_Control.java:276)
at com.ibm._jsp._Control._jspx_meth_portal$1logic_if_1(_Control.java:315)
at com.ibm._jsp._Control._jspService(_Control.java:168)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:154)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:68)
at com.ibm.wps.composition.elements.Component.render(Component.java:638)
at com.ibm.wps.composition.elements.Control.render(Control.java:159)
at com.ibm.wps.composition.Composition.render(Composition.java:3102)
at com.ibm.wps.composition.Composition.render(Composition.java:163)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:90)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:275)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:1124)
at com.ibm._jsp._UnlayeredContainer_2D_H._jspService(_UnlayeredContainer_2D_H.java:224)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:154)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:68)
at com.ibm.wps.composition.elements.Component.render(Component.java:638)
at com.ibm.wps.composition.Composition.render(Composition.java:3102)
at com.ibm.wps.composition.Composition.render(Composition.java:163)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:90)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:275)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:1124)
at com.ibm._jsp._UnlayeredContainer_2D_V._jspService(_UnlayeredContainer_2D_V.java:215)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:154)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:68)
at com.ibm.wps.composition.elements.Component.render(Component.java:638)
at com.ibm.wps.composition.Composition.render(Composition.java:3102)
at com.ibm.wps.composition.Composition.render(Composition.java:163)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:90)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:275)
at com.ibm.wps.engine.tags2.PageRenderTag.doStartTag(PageRenderTag.java:534)
at com.ibm._jsp._Home._jspService(_Home.java:104)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
at com.ibm.wps.engine.templates.screens.Default.render(Default.java:133)
at com.ibm.wps.engine.templates.ScreenTemplate.render(ScreenTemplate.java:59)
at com.ibm.wps.engine.tags2.ScreenRenderTag.doStartTag(ScreenRenderTag.java:182)
at com.ibm._jsp._Default._jspx_meth_portal$1core_screenRender_0(_Default.java:3623)
at com.ibm._jsp._Default._jspService(_Default.java:1966)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
at com.ibm.wps.engine.templates.themes.Default.doDispatch(Default.java:294)
at com.ibm.wps.engine.templates.themes.Default.render(Default.java:247)
at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:65)
at com.ibm.wps.engine.phases.WPRenderPhase.processRendering(WPRenderPhase.java:509)
at com.ibm.wps.engine.phases.WPBaseRenderPhase.execute(WPBaseRenderPhase.java:194)
at com.ibm.wps.state.phases.AbstractRenderPhase.next(AbstractRenderPhase.java:106)
at com.ibm.wps.engine.phases.WPAbstractRenderPhase.next(WPAbstractRenderPhase.java:97)
at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:860)
at com.ibm.wps.engine.Servlet.doGet(Servlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at com.ibm.wps.engine.Servlet.doFilter(Servlet.java:1257)
at com.ibm.wps.resolver.servlet.ContentHandlerCleanup.doFilter(ContentHandlerCleanup.java:648)
at com.ibm.wps.resolver.servlet.AbstractFilter.doFilter(AbstractFilter.java:93)
at com.ibm.wps.engine.Servlet.service(Servlet.java:1248)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at com.ibm.wps.engine.ExtendedLocaleFilter.doFilter(ExtendedLocaleFilter.java:113)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.wps.resolver.friendly.servlet.FriendlySelectionFilter.doFilter(FriendlySelectionFilter.java:191)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:381)
. . .
Caused by: javax.portlet.PortletException: /MyPortletView.jsp(105,9) '#{MyPortletView.productId}' Error reading 'productId' on type mytest.portal.testportlet.view.MyPortletViewBean
at com.ibm.faces.portlet.FacesPortlet.doRender(FacesPortlet.java:384)
at com.ibm.faces.portlet.FacesPortlet.doView(FacesPortlet.java:413)
at com.ibm.faces.portlet.FacesPortlet.doDispatch(FacesPortlet.java:301)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at mytest.portal.testportlet.portlet.HeaderPortlet.render(HeaderPortlet.java:44)
at com.ibm.ws.portletcontainer.invoker.impl.PortletFilterChainImpl.doFilter(PortletFilterChainImpl.java:128)
at com.ibm.wps.propertybroker.standard.filter.C2APortletFilter.doFilter(C2APortletFilter.java:183)
at com.ibm.ws.portletcontainer.invoker.impl.PortletFilterChainImpl.doFilter(PortletFilterChainImpl.java:120)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.doDispatch(PortletServlet.java:573)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:114)
at com.ibm.isclite.container.collaborator.PortletServletCollaborator.doRender(PortletServletCollaborator.java:71)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:105)
at com.ibm.ws.portletcontainer.rrd.RRDServerPortletServletCollaborator.doRender(RRDServerPortletServletCollaborator.java:123)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:105)
at com.ibm.ws.portletcontainer.cache.CacheCollaborator.doRender(CacheCollaborator.java:92)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:105)
at com.ibm.wps.pe.pc.waspc.core.impl.PortletServletCollaboratorImpl.doRender(PortletServletCollaboratorImpl.java:156)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServletCollaboratorChainImpl.doCollaborator(PortletServletCollaboratorChainImpl.java:105)
at com.ibm.ws.portletcontainer.invoker.impl.PortletServlet.doDispatch(PortletServlet.java:273)
... 203 more
Caused by: org.apache.jasper.el.JspELException: /MyPortletView.jsp(105,9) '#{MyPortletView.productId}' Error reading 'productId' on type mytest.portal.testportlet.view.MyPortletViewBean
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:106)
at javax.faces.component.UIParameter.getValue(UIParameter.java:167)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getParamList(HtmlBasicRenderer.java:518)
at com.sun.faces.renderkit.html_basic.OutputLinkRenderer.renderAsActive(OutputLinkRenderer.java:203)
at com.sun.faces.renderkit.html_basic.OutputLinkRenderer.encodeBegin(OutputLinkRenderer.java:100)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeBegin(DefaultAjaxRenderer.java:64)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:812)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:45)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:47)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:47)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:47)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:47)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at mytest.jsf.util.ChildRendererUtil.renderChildren(ChildRendererUtil.java:47)
at mytest.portal.ui.jsf.custom.component.htmltag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:110)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:836)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:292)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:223)
at com.ibm.faces.portlet.PortletViewHandlerImpl.renderView(PortletViewHandlerImpl.java:79)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:114)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at com.ibm.faces.portlet.FacesPortlet.doRender(FacesPortlet.java:372)
... 221 more
Caused by: java.lang.NullPointerException
at com.ibm.faces.portlet.httpbridge.PortletSessionWrapper.getAttributeNames(PortletSessionWrapper.java:185)
at mytest.portal.testportlet.view.MyPortletViewBean.getProductId(MyPortletViewBean.java:394)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:64)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:73)
at org.apache.el.parser.AstValue.getValue(AstValue.java:102)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:100)
... 265 more
session 范围是使用以下代码获取的:
FacesContext facesContext = getFacesContext();
if (facesContext != null) {
return (PortletSession) facesContext.getExternalContext().getSession(createIfNotExist);
}
return null;
createIfNotExist
为 false。
最佳答案
听起来像是 jsf-portletbridge.jar PortletRequestWrapper
类型中的缺陷。 JSF 引用实现被写入 servlet 规范。请求包装器实现了 HttpServletRequest
。 ExternalContext.getSession(boolean)
将调用 HttpServletRequest.getSession(boolean)
.这将返回一个装饰器对象 PortletSessionWrapper
,它实现了 HttpSession
和 PortletSession
。听起来请求装饰器返回一个 session 装饰器,即使底层 PortletSession
为 null。
我会尝试这种形式的代码:
PortletRequest request = (PortletRequest) FacesContext.getCurrentInstance()
.getExternalContext()
.getRequest();
PortletSession session = request.getPortletSession(false);
if (session == null) {
return null;
}
else {
return session.getAttribute("foo", PortletSession.APPLICATION_SCOPE);
}
关于java - IBM JSF PortletSession 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12076359/
我试图了解 JSF 实现如何识别用户的各种可能操作。在我放在一起的简单应用程序中,我在 login.xhtml 页面中配置了以下字段。 用户名 - 输入字段 密码 - 密码字段 登录按钮 取消按钮 登
我已经开始学习 JSF,我想知道在我们的类路径中包含什么 JAR 以开始使用 JSF。是jsf-api或 jsf-impl ?或者我们必须同时包含两者?如果两者都是,那么为什么它们不合并? 最佳答案
我是 java server faces (JSF) 的初学者,我需要将文本输入的内容传递到第二页以显示它,同样适用于第二页:我想将单选按钮值传递到第三页。我搜索并尝试了很多但没有成功。例如我试过
我有一个 JSF 页面。我的 CommandButton 操作方法值取决于 bean 变量值。 例子: Bean headerBean 具有可变的 actionValue,值为“someBean.do
我有两个 JSF 页面,假设 A 和 B。从这两个页面 A 和 BI 可以导航到页面 C。现在页面 C 中有一个按钮(确定按钮),单击它应该导航回 A 或 B,具体取决于从哪里(A 或 B)调用 C
我可以在没有 JSTL 标签的情况下使用 JSF 执行条件逻辑吗? 例如,我制作了一个复合组件,并想说明,如果指定了“id”属性,则定义“id”属性,但如果未指定“id”属性,则不要指定“id”属性。
我有一个应用程序,用户可以在其中从我的应用程序的欢迎页面动态切换语言环境。我看到早期的开发人员(在没有太多文档的情况下继承了代码)已经从 ViewHandler 覆盖了以下三个方法,并告诉我这是动态切
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
有没有一种方法可以在我的 JSF 2.0 应用程序中处理浏览器刷新事件,以便在浏览器刷新页面时将用户导航到欢迎页面? 这让我想到了另一个问题,即如何在托管 bean 中进行页面导航? 干杯, 最佳答案
我有两页。搜索页面是第一个接受用户输入的页面。第二页显示数据表中的结果集。第二页有 3 个面板,用于结果集、更新和在单个页面中创建。根据单击的按钮,我将面板呈现为真和假。 . . . . . .
由于我们在 Asp.Net 中有 comparevalidator,我们在 JSF 中有什么来验证两个字段的值是否相同?我想验证密码和确认密码字段。 最佳答案 不,这样的验证器在基本的 JSF 实现中
我想构建一个自定义 JSF 组件。现在我从 oracle 阅读了一些文档并看到了一些代码示例。问题是我有点困惑: 似乎有两种方法可以使用 JSF 2.0+ 构建自定义组件。据我了解,自 JSF 2.0
我遇到了与 user1598186 在他的问题中提到的相同的问题:p:commandButton doesn't call bean's method in an page 但是,没有给出解决方案(
这个问题在这里已经有了答案: Ajax update/render does not work on a component which has rendered attribute (1 个回答)
是否有内置机制可以有条件地重定向到另一个 View ?如果他/她已经登录,我希望用户从登录页面重定向到“主页”。 我已经有两种基本方法,但对于第一种我不知道如何实现,第二种是一种肮脏的解决方法。 添加
如何在 JSF 中格式化值 我需要格式化一个数字,如:12345.67 到 12,345.67 可以用模式吗? 最佳答案 尝试使用: 关于jsf - 用逗号格式化为数字 JSF,我们在Sta
根据this blog JSF 正在走向无状态。使用 JSF 的全部意义不在于它使保存和恢复状态成为一件苦差事。 JSF 成为无状态的有什么意义?您能否提供一个有用的示例。 最佳答案 首先,我想澄清
我读到某个地方(不再找到它),可以在资源包中使用EL Expresions,然后在不更改* .xhtml文件的情况下使用它。 some.text=#{someBean.stepsLeft} more
我想看一个简单的登录应用程序,不像this那么简单尽管。 我想要实现的是对 JSF 的工作原理的理解,我开发了很多 ASP.NET,您可以在其中隐藏代码,并且您可以在其中检查是否在登录时创建了 ses
如果#{myBean.birthdate}是java.util.Calendar或java.util.Date类型,我可以格式化吗this 在 EL 本身内部可能使用现有函数,其输出类似于 DateF
我是一名优秀的程序员,十分优秀!