掲示板

Composite components via portletfaces

12年前 に Alexey Truntov によって更新されました。

Composite components via portletfaces

New Member 投稿: 22 参加年月日: 11/07/15 最新の投稿
Hi, i'm using Liferay with JSF 2.0 and portletfaces 2.0.1 and trying to create composite component. Here's component itself:

<!--?xml version="1.0" encoding="UTF-8"?-->


	
<composite:interface />

<composite:implementation>
	<font size="20px">TEST</font>
</composite:implementation>
	


Component (xhtml) resides right in 'cz/bsc/g6/components/card/web/ui/component' directory in 'resources' folder. After compilation it goes to '../classes/cz/bsc/g6/components/card/web/ui/component'.

Here's using page:


<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:myutil="http://java.sun.com/jsf/composite/cz/bsc/g6/components/card/web/ui/component">
...
<myutil:button />
....
</ui:composition>


On rendering of using page i've got following exception:

13:33:51,262 ERROR [ResourceImpl:139] Resource handler=[com.sun.faces.application.resource.ResourceHandlerImpl@1ca87ea] was unable to create a resource for resourceName=[button.xhtml] libraryName=[cz/bsc/g6/components/card/web/ui/component] contentType=[null]
13:33:51,270 ERROR [jsp:154] java.lang.NullPointerException: Argument Error: Parameter url is null
	at com.sun.faces.util.Util.notNull(Util.java:299)
	at com.sun.faces.facelets.impl.DefaultFaceletCache.isFaceletCached(DefaultFaceletCache.java:130)
	at com.sun.faces.facelets.impl.DefaultFaceletFactory.needsToBeRefreshed(DefaultFaceletFactory.java:264)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:219)
	at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:936)
	at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605)
	at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.createComponent(CompositeComponentTagHandler.java:165)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:484)
	at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:157)
	at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at com.sun.faces.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:225)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
	at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:166)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
	at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)


Could someone tell me what i'm doing wrong? It seems to be valid composite component usage for me.
thumbnail
12年前 に Neil Griffin によって更新されました。

RE: Composite components via portletfaces

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Rather than having the resources live in the classpath, try putting your resources in src/main/webapp/resources/myutil

That's the way Example JSF2 portlet does it:
https://github.com/liferay/liferay-faces/blob/master/demos/bridge/jsf2-portlet/src/main/webapp/resources/

Also, the following view shows how the namespace is used:
https://github.com/liferay/liferay-faces/blob/master/demos/bridge/jsf2-portlet/src/main/webapp/views/applicant.xhtml

Like this:
xmlns:example-cc="http://java.sun.com/jsf/composite/example-cc
12年前 に Alexey Truntov によって更新されました。

RE: Composite components via portletfaces

New Member 投稿: 22 参加年月日: 11/07/15 最新の投稿
Many thanks, Neil, it works.
12年前 に Alexey Truntov によって更新されました。

RE: Composite components via portletfaces

New Member 投稿: 22 参加年月日: 11/07/15 最新の投稿
Now we have problems on Weblogic.

Composite components are found in project wars and correctly rendered on page, but when any server requests initiated on page with composites we get following errors in WLS logs and all those requests fail.
        ...
Apr 3, 2012 2:13:21 PM com.sun.faces.facelets.tag.jsf.CompositeComponentTagLibrary tagLibraryForNSExists
INFO: Skipping call to libraryExists().  Please set context-param com.sun.faces.enableMissingResourceLibraryDetection to true to verify if library http://java.sun.com/jsf/composite/bscutil actually exists
<apr 3, 2012 2:13:22 pm msk> <error> <http session> <bea-100028> <could not deserialize session data. java.io.notserializableexception: org.portletfaces.bridge.container.liferay.portletcontainerliferayimpl at java.io.objectoutputstream.writeobject0(objectoutputstream.java:1164) java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1518) java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1483) java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1400) java.io.objectoutputstream.writeobject0(objectoutputstream.java:1158) truncated. see log file for complete stacktrace>
14:13:26,358 INFO  [PortalImpl:3829] Current URL /ru/group/hcfb/products?_ProductsThreePanelForm_WAR_hcfbibserverportalapp__facesViewId=%2Fcz%2Fbsc%2Fg6%2Fliferay%2Fpage%2FWindowPage.xhtml&amp;p_p_col_count=1&amp;p_p_col_id=column-1&amp;p_p_id=ProductsThreePanelForm_WAR_hcfbibserverportalapp&amp;p_p_lifecycle=2 generates exception: java.lang.NullPointerException
14:13:26,411 ERROR [jsp:1009] org.portletfaces.bridge.BridgeException: java.lang.NullPointerException
org.portletfaces.bridge.BridgeException: java.lang.NullPointerException
    at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:547)
    at org.portletfaces.bridge.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:131)
    at cz.bsc.g6.components.base.portal.ui.system.SystemFacesPortlet.serveResource(SystemFacesPortlet.java:157)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:119)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:635)
    at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:747)
    at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:504)
    at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:871)
    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:613)
    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:232)
        ...</could></bea-100028></http></error></apr>


Any ideas are greatly appreciated.

PS: i've tried to turn on optimistic synchronization in WLS, but the error still persist.
thumbnail
11年前 に Neil Griffin によって更新されました。

RE: Composite components via portletfaces

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Hi Alexey,

Sorry for the late reply but somehow I missed your post. First, I would recommend upgrading to Liferay Faces Bridge. If you still get the NotSerializableException in WebSphere AS, then please checkout the source from Git and have the PortletContainerLiferayImpl class implement Serializable. Also add a serialVersionUID field. If that fixes it, then let me know and we can add that.

Neil
11年前 に Alexey Truntov によって更新されました。

RE: Composite components via portletfaces

New Member 投稿: 22 参加年月日: 11/07/15 最新の投稿
Thanks, Neil. We'll try your solution later.