Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alexey Truntov
Composite components via portletfaces
March 20, 2012 7:07 AM
Answer

Alexey Truntov

Rank: New Member

Posts: 22

Join Date: July 15, 2011

Recent Posts

Hi, i'm using Liferay with JSF 2.0 and portletfaces 2.0.1 and trying to create composite component. Here's component itself:

 1<?xml version="1.0" encoding="UTF-8"?>
 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 3<html xmlns="http://www.w3.org/1999/xhtml"
 4    xmlns:composite="http://java.sun.com/jsf/composite">
 5   
 6<composite:interface/>
 7
 8<composite:implementation>
 9    <font size="20px">TEST</font>
10</composite:implementation>
11   
12</html>


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:

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 3    xmlns:f="http://java.sun.com/jsf/core"
 4    xmlns:h="http://java.sun.com/jsf/html"
 5    xmlns:ui="http://java.sun.com/jsf/facelets"
 6    xmlns:p="http://primefaces.prime.com.tr/ui"
 7    xmlns:c="http://java.sun.com/jsp/jstl/core"
 8    xmlns:myutil="http://java.sun.com/jsf/composite/cz/bsc/g6/components/card/web/ui/component">
 9...
10<myutil:button/>
11....
12</ui:composition>


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

 113: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]
 213:33:51,270 ERROR [jsp:154] java.lang.NullPointerException: Argument Error: Parameter url is null
 3    at com.sun.faces.util.Util.notNull(Util.java:299)
 4    at com.sun.faces.facelets.impl.DefaultFaceletCache.isFaceletCached(DefaultFaceletCache.java:130)
 5    at com.sun.faces.facelets.impl.DefaultFaceletFactory.needsToBeRefreshed(DefaultFaceletFactory.java:264)
 6    at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:219)
 7    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:936)
 8    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605)
 9    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.createComponent(CompositeComponentTagHandler.java:165)
10    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:484)
11    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:157)
12    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
13    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
14    at com.sun.faces.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:225)
15    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
16    at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:166)
17    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
18    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
19    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
20    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
21    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
22    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.
Neil Griffin
RE: Composite components via portletfaces
March 20, 2012 8:16 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2256

Join Date: July 26, 2005

Recent Posts

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
Alexey Truntov
RE: Composite components via portletfaces
March 20, 2012 11:35 AM
Answer

Alexey Truntov

Rank: New Member

Posts: 22

Join Date: July 15, 2011

Recent Posts

Many thanks, Neil, it works.
Alexey Truntov
RE: Composite components via portletfaces
April 4, 2012 4:10 AM
Answer

Alexey Truntov

Rank: New Member

Posts: 22

Join Date: July 15, 2011

Recent Posts

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.
 1        ...
 2Apr 3, 2012 2:13:21 PM com.sun.faces.facelets.tag.jsf.CompositeComponentTagLibrary tagLibraryForNSExists
 3INFO: 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
 4<Apr 3, 2012 2:13:22 PM MSK> <Error> <HTTP Session> <BEA-100028> <Could not deserialize session data.
 5java.io.NotSerializableException: org.portletfaces.bridge.container.liferay.PortletContainerLiferayImpl
 6    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
 7    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
 8    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
 9   at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
10    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
11    Truncated. see log file for complete stacktrace
12>
1314:13:26,358 INFO  [PortalImpl:3829] Current URL /ru/group/hcfb/products?_ProductsThreePanelForm_WAR_hcfbibserverportalapp__facesViewId=%2Fcz%2Fbsc%2Fg6%2Fliferay%2Fpage%2FWindowPage.xhtml&p_p_col_count=1&p_p_col_id=column-1&p_p_id=ProductsThreePanelForm_WAR_hcfbibserverportalapp&p_p_lifecycle=2 generates exception: java.lang.NullPointerException
1414:13:26,411 ERROR [jsp:1009] org.portletfaces.bridge.BridgeException: java.lang.NullPointerException
15org.portletfaces.bridge.BridgeException: java.lang.NullPointerException
16    at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:547)
17    at org.portletfaces.bridge.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:131)
18    at cz.bsc.g6.components.base.portal.ui.system.SystemFacesPortlet.serveResource(SystemFacesPortlet.java:157)
19    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:119)
20    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
21    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
22    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
23    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
24    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
25    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
26    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
27    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
28    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
29    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
30    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
31    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
32    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:635)
33    at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:747)
34    at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:504)
35    at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:871)
36    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:613)
37    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:232)
38        ...


Any ideas are greatly appreciated.

PS: i've tried to turn on optimistic synchronization in WLS, but the error still persist.
Neil Griffin
RE: Composite components via portletfaces
May 16, 2012 12:33 PM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2256

Join Date: July 26, 2005

Recent Posts

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
Alexey Truntov
RE: Composite components via portletfaces
May 17, 2012 2:32 AM
Answer

Alexey Truntov

Rank: New Member

Posts: 22

Join Date: July 15, 2011

Recent Posts

Thanks, Neil. We'll try your solution later.