在WebSphere Portal 8部署JSF 2.0的portletPortal、WebSphere、JSF、portlet

2023-09-10 17:53:25 作者:落幕的夕阳

我有运行JSF 2.0的Portlet在WebSphere Portal 8.如果我不使用的问题< F:AJAX> 标签,它看起来像应用程序的工作不知何故。但是,当我加入< F:AJAX> portlet中不呈现在SystemOut.log中我可以看到:

  0000003c FaceletViewDe E错误渲染查看[/views/Home.xhtml]
                                 显示java.lang.NullPointerException
    在com.ibm.faces20.portlet.util.WebXMLParser.endElement(WebXMLParser.java:115)
    在org.apache.xerces.parsers.AbstractSAXParser.endElement(来源不明)
    在org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(来源不明)
    在org.apache.xerces.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDispatcher.dispatch(来源不明)
    在org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(来源不明)
    在org.apache.xerces.parsers.XML11Configuration.parse(来源不明)
    在org.apache.xerces.parsers.XML11Configuration.parse(来源不明)
    在org.apache.xerces.parsers.XMLParser.parse(来源不明)
    在org.apache.xerces.parsers.AbstractSAXParser.parse(来源不明)
    在org.apache.xerces.jaxp.SAXParserImpl $ JAXPSAXParser.parse(来源不明)
    在org.apache.xerces.jaxp.SAXParserImpl.parse(来源不明)
    在javax.xml.parsers.SAXParser.parse(来源不明)
    在com.ibm.faces20.portlet.util.WebXMLParser< INIT>(WebXMLParser.java:51)
    在com.ibm.faces20.portlet.httpbridge.PortletResource.getRequestPath(PortletResource.java:106)
    在org.apache.myfaces.shared_impl.renderkit.html.util.ResourceUtils.renderDefaultJsfJsInlineIfNecessary(ResourceUtils.java:204)
    在org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.en$c$cEnd(HtmlTextRendererBase.java:69)
    在javax.faces.component.UIComponentBase.en codeEND(UIComponentBase.java:535)
    在javax.faces.component.UIComponent.en codeALL(UIComponent.java:626)
    在javax.faces.component.UIComponent.en codeALL(UIComponent.java:622)
    在javax.faces.component.UIComponent.en codeALL(UIComponent.java:622)
...
 

我已经配置应用程序中使用IBM Portlet的桥梁包括在WebSphere Application Server 8.在faces-config.xml中我说:

<view-handler>com.ibm.faces20.portlet.FaceletPortletViewHandler</view-handler> <resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler> &LT; EL-解析&GT; com.ibm.faces20.portlet.PortletELResolver&LT; / EL-解析&GT;

在portlet.xml中我使用IBM类,如:

  ...
&LT;的portlet级&GT; com.ibm.faces20.portlet.FacesPortlet&LT; / portlet的一流&GT;
&LT;初始化参数&GT;
    &LT;名称&gt;&com.ibm.faces.portlet.page.view LT; /名称&gt;
    &LT;价值&GT; /views/Home.xhtml< /值GT;
&LT; /初始化参数&GT;
...
 
WebSphere Portal首页 文档和下载 门户平台PORTAL OSCHINA

我发现,当我删除 <resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler> faces-config.xml的应用程序的工作原理,即使标签。但是,除了 jsf.js 丢失,因此所有的AJAX JavaScript调用失败。因此,应用程序的行为一样,如果没有为present。

我会gratefull任何帮助或建议。

我试图让JSF 2.0的Portlet在WebSphere Portal上运行,现在8 5天,疼痛几乎没有成功,很大。这是很少的文件,很难无源(我要反编译的类!)。蹩脚的专有封闭源代码!

解决方案

好了,问题是在声明的面的Servlet 的web.xml 的名称面临的Servlet 是非常重要的WebSphere Portal中8.必须准确

  

面的Servlet

与确切情况。像这样的:

 &LT;的servlet&GT;
    &LT;描述&GT;
        Servlet的,做的服务JSF请求工作。
    &LT; /描述&GT;
    &LT; servlet的名称&gt;面的Servlet&LT; / Servlet的名称&gt;
    &LT;的servlet类&GT; javax.faces.w​​ebapp.FacesServlet&LT; / Servlet的类&GT;
    &所述;负载上启动→1&其中; /负载上启动&GT;
    &LT;启用&GT;真&LT; /启用&GT;
    &LT;异步支持&GT;假&LT; /异步支持&GT;
&LT; / servlet的&GT;
 

如果你不保持这个servlet名称晦涩异常被抛出上面​​写的。这种行为是非常奇怪和科钦prehensible我。没有发现有关面孔的Servlet规范名称事情。我不知道是否有任何其他门户网站服务器需要这样的事。

I've got problem running JSF 2.0 Portlet in Websphere Portal 8. If I don't use <f:ajax> tag it looks like application works somehow. But when I add <f:ajax> portlet is not rendered and in SystemOut.log I can see:

0000003c FaceletViewDe E   Error Rendering View[/views/Home.xhtml]
                                 java.lang.NullPointerException
    at com.ibm.faces20.portlet.util.WebXMLParser.endElement(WebXMLParser.java:115)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at com.ibm.faces20.portlet.util.WebXMLParser.<init>(WebXMLParser.java:51)
    at com.ibm.faces20.portlet.httpbridge.PortletResource.getRequestPath(PortletResource.java:106)
    at org.apache.myfaces.shared_impl.renderkit.html.util.ResourceUtils.renderDefaultJsfJsInlineIfNecessary(ResourceUtils.java:204)
    at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:69)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:535)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:626)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622)
...

I've configured application to use IBM Portlet bridge included in WebSphere Application Server 8. In faces-config.xml I added:

<view-handler>com.ibm.faces20.portlet.FaceletPortletViewHandler</view-handler>
<resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler>
<el-resolver>com.ibm.faces20.portlet.PortletELResolver</el-resolver>

In portlet.xml I use IBM classes like:

...
<portlet-class>com.ibm.faces20.portlet.FacesPortlet</portlet-class>
<init-param>
    <name>com.ibm.faces.portlet.page.view</name>
    <value>/views/Home.xhtml</value>
</init-param>
...

I found out that when I remove <resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler> from faces-config.xml application works even with tags. But than jsf.js is missing so all AJAX JavaScript calls fails. Thus application acts like if no is present.

I would be gratefull for any help or advice.

I'm trying to make JSF 2.0 portlets run on WebSphere Portal 8 for 5 days now, with almost no success and lot of pain. It's very difficult with little documentation, no sources (I have to decompile classes!). Crappy proprietary closed-source!

解决方案

Ok the problem was in declaration of Faces Servlet in web.xml. The name of Faces Servlet is very important in WebSphere Portal 8. It has to be exactly

Faces Servlet

with exact case. Like this:

<servlet>
    <description>
        Servlet that does the job for serving JSF requests.
    </description>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <enabled>true</enabled>
    <async-supported>false</async-supported>
</servlet>

If you don't keep to this servlet name obscure exceptions are thrown as written above. This behavior is very strange and incomprehensible for me. Didn't found anything about Faces Servlet canonical name. I'm not sure if any other Portal server requires anything like this.