I am running a JSF 2.3 + Spring MVC application on IBM WebSphere Liberty Server 24.0.0.5, but I encounter the following error during startup:
The MyFaces JSF Implementation is selected for SampleApp but a Sun RI ConfigureListener is also registered.
I am not using MyFaces. Instead, I am using Mojarra (GlassFish JSF Implementation).
My server.xml configuration is as follows:
<server description="new server">
<featureManager>
<feature>jsf-2.3</feature>
<feature>cdi-2.0</feature>
<feature>jdbc-4.2</feature>
<feature>servlet-4.0</feature>
<feature>websocket-1.1</feature>
</featureManager>
<httpEndpoint httpPort="9081" httpsPort="9443" id="defaultHttpEndpoint"/>
<applicationManager autoExpand="true"/>
<webApplication contextRoot="SampleApp" id="SampleApp"
location="D:\workspace\SampleApp\target\SampleApp-0.0.1-SNAPSHOT.war" name="SampleApp">
<classloader apiTypeVisibility="spec, ibm-api, third-party"/>
</webApplication>
</server>
My web.xml contains the following setup:
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Note: I am only using Mojarra and not MyFaces, yet Liberty seems to detect MyFaces for some reason.
Here are the relevant dependencies in my pom.xml:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.3.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-core</artifactId>
<version>3.1.8.Final</version>
</dependency>
Checked if any MyFaces dependencies exist using mvn dependency:tree No MyFaces dependencies were found.
Checked WEB-INF/lib for any extra JSF implementations: Found and removed javax.faces-api-2.2.jar.
Still seeing the same error message. Stack Dump = java.lang.NullPointerException at com.sun.faces.config.InitFacesContext.cleanupInitMaps(InitFacesContext.java:312) at com.sun.faces.config.InitFacesContext.(InitFacesContext.java:116) at com.sun.faces.config.FacesInitializer.onStartup(FacesInitializer.java:148) at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2577) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1052) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6722) at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:484) at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:479) at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1208) at com.ibm.ws.webcontainer.osgi.WebContainer.access$100(WebContainer.java:113) at com.ibm.ws.webcontainer.osgi.WebContainer$3.run(WebContainer.java:996) at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:280) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Questions:
Any help would be greatly appreciated!
You have configured the Liberty jsf-2.3
feature which includes Apache MyFaces as a JSF implementation. You have also then included Mojarra in your application. The error message is warning you that you have done this because you almost certainly don't mean to do this.
If you want to use Mojarra you should change jsf-2.3
to jsfContainer-2.3
which will detect Mojarra and ensure you have the expected container integration between our other runtimes and Mojarra without bringing in a JSF implementation at the same time.