Websphere 8.5 - JSF web application context initialization error: cleanupInitMaps

I have a JSF 2.1 web application developed using the mojarra 2.1.17 definition that works with any problems in the JBoss 6.1 container: now I need to change the application server and I need to use websphere AS 8.5 that were born with MyFaces JSF 2 from distribution kit. I am trying to deploy and run my webapp, ignoring MyFaces and using Mojarra, setting up my EAR, as the official IBM guide shows, setting up a shared lib with mojarra dist enabled, associates it with a new classloader created exclusively for my server1 WAS 8.5 instance. This does not work at all, and when I deploy my webapp, I get this glass when I try to start the application:

com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: null at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994) at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862) Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: null at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426) ... 14 more Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: null at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749) ... 16 more Caused by: java.lang.NullPointerException at com.sun.faces.config.InitFacesContext.cleanupInitMaps(InitFacesContext.java:283) at com.sun.faces.config.InitFacesContext.<init>(InitFacesContext.java:107) at com.sun.faces.config.FacesInitializer.onStartup(FacesInitializer.java:115) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:613) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169) ... 17 more 

I was debugging the cleanupInitMaps () method of mojarra dist too, and I saw that it was trying to get two maps of the form of a variable from FacesContext called threadInitContext and initContextServletContext , but was getting null

 Field threadMap = FacesContext.class.getDeclaredField("threadInitContext"); and Field initContextMap = FacesContext.class.getDeclaredField("initContextServletContext"); 

How is this caused and how can I solve it?

+4
source share
2 answers

Ok, I decided! First of all, I set the class loader of my server instance to PARENT_LAST + restart. Then I followed these steps: 1) put Mojarra lib in a simple shared library; 2) expand your ear with the jsf web module inside and before launching the application from the console, I linked it to all the modules inside the ear; 3) I installed the application class loader in PARENT_LAST; 4) run the application and it works!

What all!!

+2
source

I ran into the same problem. In my case, the problem was resolved by removing javax.faces depending on the .war artifact. This seems to be a conflict between the javax.faces WS implementation and the dependency in my .war file. If you use maven, then you can set the scope for youre javax.faces somthing dependency like this:

  <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.2.13</version> <scope>provided</scope> </dependency> 

See also: Nullpointer exception in com.sun.faces.config.InitFacesContext.cleanupInitMaps

0
source

Source: https://habr.com/ru/post/1502818/


All Articles