I am trying to deploy a JSF 2.1 webapplication to a Weblogic 12.1 application server, but the deployment fails with the following exception
<javax.enterprise.resource.webcontainer.jsf.config> <BEA-000000>
<Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
com.oracle.injection.integration.jsf.WeblogicFacesConfigResourceProvider
cannot be cast to com.sun.faces.spi.ConfigurationResourceProvider
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:377)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
Truncated. see log file for complete stacktrace
I am using the Mojarra implementation Version 2.1.13 - here is the corresponding pom.xml
entry:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.13</version>
</dependency>
I added the following lines to the weblogic.xml
to prevent the weblogic server from loading the shipped jsf implementation:
<container-descriptor>
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>javax.faces.*</package-name>
<package-name>com.sun.faces.*</package-name>
<package-name>com.bea.faces.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
</prefer-application-resources>
</container-descriptor>
The WeblogicFacesConfigResourceProvider
is contained in the weblogic.jar
.
So what's going wrong here? - Any hints?
Okay, I found the solution: you have to add the META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider
to the prefer-application-resources
-section in the weblogic.xml
. This configuration works for me:
false
javax.faces.
com.sun.faces.
com.bea.faces.*
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
</prefer-application-resources>
</container-descriptor>
Adding the solution mentioned by oehmiche
in his question as an answer.
Add the META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider to the prefer-application-resources-section in the weblogic.xml. This configuration works for me: false javax.faces. com.sun.faces. com.bea.faces.*
<prefer-application-resources>
<resource-name>javax.faces.*</resource-name>
<resource-name>com.sun.faces.*</resource-name>
<resource-name>com.bea.faces.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
</prefer-application-resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With