Search code examples
liferayliferay-6portal

NullPointerException for liferay-faces-bridge-api-4


The error I got when I was trying to use Liferay bridge 4:

21:18:00,794 ERROR [PortletContainerLiferayImpl:171] null
 2java.lang.NullPointerException
 3        at com.liferay.faces.bridge.container.liferay.PortletContainerLiferayImpl.getRequestURL(PortletContainerLiferayImpl.java:392)
 4        at com.liferay.faces.bridge.container.liferay.PortletContainerLiferayImpl.<init>(PortletContainerLiferayImpl.java:168)
 5        at com.liferay.faces.bridge.container.PortletContainerFactoryImpl.getPortletContainer(PortletContainerFactoryImpl.java:43)
 6        at com.liferay.faces.bridge.BridgePhaseBaseImpl.init(BridgePhaseBaseImpl.java:172)
 7        at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:118)
 8        at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:84)
 9        at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:117)
10        at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)
11        at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
12        at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204)

Solution

  • I recommend that you start with a clean project by following the steps in the Generating a Liferay Faces Portlet using mvn archetype generate wiki article. Note that in pom.xml, you will need to change com.sun.faces 2.1.21 to 2.2.6 and com.liferay.faces 3.2.4-ga5 to 4.2.0-m2. Also you will need to add the Liferay Previews repository:

    <repository>
        <id>liferay-previews</id>
        <url>
          https://repository.liferay.com/nexus/content/repositories/liferay-previews
        </url>
    </repository>
    

    For more information, see the blog titled Announcement: Liferay Faces 4.2.0-m2 Released.