Making JSF jars into a separate JBoss Module
devikumar.ramalingam Oct 6, 2012 1:56 PMThe goal is to move the JSF related jars in the Web app /lib folder to a custom module, so that this can be shared across other applications.
Server : JBoss EAP 6
Portal Framework : Liferay
After deleting the JSF jars from WEB-INF\lib and moving to modules,
1. Caused by: java.lang.NoClassDefFoundError: javax/el/CompositeELResolver
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30] - added <module name="javax.el.api"/>
2. Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagSupport
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30] - added <module name="javax.servlet.jsp.api"/>
3. Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ls/LSResourceResolver
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30] - added <path name="org/w3c/dom/ls"/>
4. Caused by: java.lang.NoClassDefFoundError: javax/xml/validation/SchemaFactory
at com.sun.faces.config.DbfFactory.initStatics(DbfFactory.java:246) [jsf-impl-2.1.3-b02.jar:2.1.3-FCS]
at com.sun.faces.config.DbfFactory.<clinit>(DbfFactory.java:208) [jsf-impl-2.1.3-b02.jar:2.1.3-FCS]
at com.sun.faces.config.ConfigManager$ParseTask.<init>(ConfigManager.java:890) [jsf-impl-2.1.3-b02.jar:2.1.3-FCS] - added <path name="javax/xml/validation"/>
5. Caused by: java.lang.NoClassDefFoundError: javax/portlet/PortletRequest
at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.6.0_30]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [rt.jar:1.6.0_30] - added <module name="com.liferay.portal"/>
6. Caused by: java.lang.NullPointerException
at javax.portlet.faces.GenericFacesPortlet.init(GenericFacesPortlet.java:92)
at com.clink.QportalFacesPortlet.init(QportalFacesPortlet.java:32)
at com.liferay.portlet.InvokerPortletImpl.init(InvokerPortletImpl.java:246) [portal-impl.jar:] --added <module name="com.centurylink.jsf" export="true" meta-inf="export"/>
The issue now is :
getBridge().init(portletConfig);, init(PortletConfig portletConfig) -- GenericFacesPortlet.class - getBridge() returns com.liferay.faces.bridge.BridgeImpl
BridgeImpl.init(portletConfig) -- bridgePhaseFactory = (BridgePhaseFactory) BridgeFactoryFinder
.getFactory(com / liferay / faces / bridge / BridgePhaseFactory);
getInstance().getFactoryInstance(clazz) -- getInstance() returns BridgeFactoryFinderImpl
BridgeFactoryFinderImpl.getFactoryInstance returns null.
As bridgeFactoryCache.get("com / liferay / faces / bridge / BridgePhaseFactory") is null when we remove the jsf jars from lib in WAR. When it is present in war, it is having the value.
We get bridgeFactoryCache from bridgeFactoryCache = (Map) portletContext.getAttribute("com.liferay.faces.bridge.bridgeFactoryCache");
Because of this, we get the following Null Pointer Exception
15:20:44,305 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/business].[loginPortlet Servlet]] (http-localhost-127.0.0.1-8080-3) Servlet.service() for servlet loginPortlet Servlet threw exception: java.lang.NullPointerException
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:98) [liferay-faces-bridge-impl-3.1.0-ga1-20120815.195703-20.jar:3.1.0-ga1-SNAPSHOT (Galatia / Aug 15, 2012 AD)]
at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255) [liferay-faces-bridge-api-3.1.0-ga1-20120815.195659-20.jar:3.1.0-ga1-SNAPSHOT (Galatia / Aug 15, 2012 AD)]
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328) [portlet.jar:]
at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204) [liferay-faces-bridge-api-3.1.0-ga1-20120815.195659-20.jar:3.1.0-ga1-SNAPSHOT (Galatia / Aug 15, 2012 AD)]
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233) [portlet.jar:]
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64) [portal-service.jar:]
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93) [portal-service.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72) [portal-service.jar:]
Could you please suggest what has gone wrong or what has to be done to successfully make JSF jars into a module?