Foren

MyFaces RI support

Ashish Sarin, geändert vor 13 Jahren.

MyFaces RI support

New Member Beiträge: 14 Beitrittsdatum: 19.04.09 Neueste Beiträge
Hi,

I don't see mentioned anywhere that MyFaces RI is supported by Portletfaces. Does it mean that portletfaces bridge will work only with Mojarra ?

regards
ashish
thumbnail
Neil Griffin, geändert vor 13 Jahren.

RE: MyFaces RI support

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Currently all testing has been done with Mojarra. Anyone out there in the community trying the bridge with the MyFaces implementation of JSF 2?
PortletFaces Community Member, geändert vor 12 Jahren.

RE: MyFaces RI support

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
Hi Neil,

Currently I try to deploy my JSF2 portlet with the following libs:
myfaces-api-2.1.1.jar
myfaces-impl-2.1.1.jar
portletfaces-bridge-2.0.0.jar

Unfortunately, MyFaces doesn't allow to call getRequest() at start up time. So, I catch the following exception:

An error occured while initializing MyFaces: This method is not supported during startup
java.lang.UnsupportedOperationException: This method is not supported during startup
at org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getRequest(StartupServletExternalContextImpl.java:99)
at org.portletfaces.bridge.application.ApplicationImpl.getNavigationHandler(ApplicationImpl.java:88)
at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:510)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:401)

Any idea to solve the problem?
thumbnail
Neil Griffin, geändert vor 12 Jahren.

RE: MyFaces RI support

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Thanks for trying this out. Recommend that you change the Bridge's ApplicationImpl.getNavigationHandler() method to look like this and let me know if it fixes the problem:


	@Override
	public NavigationHandler getNavigationHandler() {

		// NOTE: Mojarra uses a servlet context listener to pre-load all the faces-config.xml files in the classpath.
		// During this initialization, it will call this method override for whatever reason. But we can't ask the
		// BridgeFactoryFinder to find the BridgeNavigationHandler factory at that time because it relies on the
		// PortletContext object which can only be retrieved at runtime. So for this reason, we have to delay the
		// wrapping the Faces default NavigationHandler until a PortletRequest happens at runtime.
		if (wrapHandlerAtRuntime) {

			FacesContext facesContext = FacesContext.getCurrentInstance();

			if (facesContext != null) {

				try {
					PortletRequest portletRequest = (PortletRequest) facesContext.getExternalContext().getRequest();

					if (portletRequest != null) {
						BridgeFactoryFinder bridgeFactoryFinder = BridgeFactoryFinder.getInstance();
						BridgeNavigationHandlerFactory bridgeNavigationHandlerFactory = (BridgeNavigationHandlerFactory)
							bridgeFactoryFinder.getFactory(BridgeFactoryFinder.BRIDGE_NAVIGATION_HANDLER_FACTORY);
						BridgeNavigationHandler bridgeNavigationHandler =
							bridgeNavigationHandlerFactory.getBridgeNavigationHandler(super.getNavigationHandler());
						super.setNavigationHandler(bridgeNavigationHandler);
						wrapHandlerAtRuntime = false;
					}
				}
				catch (UnsupportedOperationException e) {
					// ignore -- MyFaces does not permit calling getRequest() during startup.
				}
			}
		}

		return super.getNavigationHandler();
	}
PortletFaces Community Member, geändert vor 12 Jahren.

RE: MyFaces RI support

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
Hi,
Thanks for your reply. After the change in ApplicationImp my app started clean. But the following NPE was caught when adding the portlet to a potral page:

org.portletfaces.bridge.BridgeException: java.lang.NullPointerException
at BridgeImpl.java.doFacesRequest(BridgeImpl.java:438)
at org.portletfaces.bridge.GenericFacesPortlet.doView(GenericFacesPortlet.java:181)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)

It was caused by this reference in the BridgeFlashFactory:

MYFACES_FLASH_FQCN = "org.apache.myfaces.shared_portlet.context.flash.FlashImpl";

I only can find this class in MyFaces portlet bridge 3.0. So I changed the value to:

MYFACES_FLASH_FQCN = "org.apache.myfaces.shared_impl.context.flash.FlashImpl";

Now, the portlet works fine without any exception.

Are you agree with this change?
PortletFaces Community Member, geändert vor 12 Jahren.

RE: MyFaces RI support

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
Hi Neil,

Do you plan to take the fixes in ApplicationImpl and BridgeFlashFactory on the next release?

Thanks,
Wahid
thumbnail
Neil Griffin, geändert vor 12 Jahren.

RE: MyFaces RI support

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Yes, thanks for your help in testing! The fixes have been committed to the SVN trunk. Here are the related JIRA tickets:
http://issues.liferay.com/browse/FACES-246
http://issues.liferay.com/browse/FACES-247
Wahid Bashirazad, geändert vor 10 Jahren.

RE: MyFaces RI support

New Member Beiträge: 8 Beitrittsdatum: 12.08.08 Neueste Beiträge
Hi Neil,

I've to reanimate this thread with a question about general MyFaces support by Liferay 6.*.

Myfaces is the Framework for all of our web applications in our company and currently we use version 2.1.6.
As features of Liferay Faces Bridge on the web site I can find Mojarra, ICEFaces, Richfaces and Primefaces but not Myfaces!

Does it mean that we'll be not able to develope Myfaces portlets for liferay 6 and have to change the existing portlets which works on Liferay 5.2.3?

Do you plan to support Myfaces in the future Liferay versions?

We plan to purchase the EE version and the support of myFaces is one of our important requirements.

Thanks for any information you could provide us on this issue.

Best regards
Wahid
thumbnail
Neil Griffin, geändert vor 10 Jahren.

RE: MyFaces RI support

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Hi Wahid,

As of the time of this writing, the Liferay EE support team currently provides support for Mojarra since it is the official reference implementation provided by Oracle.

When we do testing with MyFaces, we rebuild all of our sample portlets like this:

mvn -Dfaces-impl=myfaces clean package


Click here for a list of known issues related to MyFaces.

Regarding your purchase of EE, are you in contact with a sales person at Liferay?

Thanks,

Neil
Wahid Bashirazad, geändert vor 10 Jahren.

RE: MyFaces RI support

New Member Beiträge: 8 Beitrittsdatum: 12.08.08 Neueste Beiträge
Hi Neil,

Thanks for the information. Yes, we're already in contact with Liferay sales and they also told us about the Mojarra support in EE.
Now we should discuss internally what it means for us to move from MyFaces to Mojarra. Actually, we prefer to go on with Myfaces since it's also shipped with our application server Websphere.
We are currently challenging the following NullPointerException when we try to open a Myfaces 2.1.6 Portlet on Websphere 8 and Liferay 6.0 with LiferayFaces 3.0.1.
Any idea how to fix it?
Best regards
Wahid

Exception created : Ýjavax.portlet.faces.BridgeException: java.lang.NullPointerException: lifecycle
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:91)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:112)
at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1384)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:548)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:425)
at com.ibm._jsp._render_5F_portlet._jspService(_render_5F_portlet.java:1448)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
thumbnail
Neil Griffin, geändert vor 10 Jahren.

RE: MyFaces RI support

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Hi Wahid,

WebSphere 8.0 ships with MyFaces Core 2.0 as the default implementation of JSF, which is not compatible with Liferay Faces Bridge since it depends on JSF 2.1.

For this reason, we wrote a wiki article titled Deploying JSF Portlets on IBM WebSphere that shows how to upgrade WebSphere to Mojarra 2.1.x

Kind Regards,

Neil