java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory (Doc ID 2122194.1)

Last updated on AUGUST 03, 2017

Applies to:

Oracle WebLogic Server - Version 12.2.1.0.0 and later
Information in this document applies to any platform.

Symptoms

Customer application works using JSF 2.1.5 as out of the box in WLS 12.1.1. Now they have upgraded to WLS 12.2.1, but need to continue to use JSF version 2.1.5 and not version 2.2.8 offered by WLS 12.2.1.

In order to do this, having more applications based on JSF, they took advantage of the mechanism described here: https://docs.oracle.com/cd/E13222_01/wls/docs92/programming/classloading.html#filteri

Customer specified in weblogic-application.xml both prefer-application-packages and prefer-application-resources as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_6.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.7/weblogic-application.xsd">
  <!--weblogic-version:12.2.1 -->
  <wls:application-param>
  <wls:param-name>webapp.encoding.default</wls:param-name>
  <wls:param-value>UTF-8</wls:param-value>
  </wls:application-param>

  <wls:prefer-application-packages>
    <wls:package-name>javax.faces.*</wls:package-name>
    <wls:package-name>com.sun.faces.*</wls:package-name>
  </wls:prefer-application-packages>

  <wls:prefer-application-resources>
    <wls:resource-name>javax.faces.*</wls:resource-name>
    <wls:resource-name>com.sun.faces.*</wls:resource-name>
    <wls:resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</wls:resource-name>
    <wls:resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</wls:resource-name>
    <wls:resource-name>META-INF/resources/javax.faces/jsf.js</wls:resource-name>
    <wls:resource-name>META-INF/resources/javax.faces/jsf-uncompressed.js</wls:resource-name>
  </wls:prefer-application-resources>
</wls:weblogic-application>

 

When deploying the EAR the following error is thrown:

####<Mar 14, 2016 12:45:14 PM EDT> <Error> <Deployer> <NIMYNENI-US> <AdminServer> <[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <233add58-79f9-40a9-9882-27fe01d5e332-0000001b> <1457973914497> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-149265> <Failure occurred in the execution of deployment request with ID "63989652690099" for task "1" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. "
weblogic.application.ModuleException: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
  at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:237)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:232)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
  at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:82)
  at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:52)
  at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:753)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
  at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:263)
  at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:67)
  at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
  at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
  at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:601)
  at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:171)
  at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:121)
  at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:343)
  at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:895)
  at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1422)
  at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:454)
  at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:181)
  at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
....................

The same works fine if the <prefer-application-resources> are defined in the WEB-INF/weblogic.xml of the WAR. The WAR file gets deployed successfully.

The customer tried to include the package javax.faces.context.* in the <prefer-application-packages> in the weblogic-application.xml but had no success. They also included the jsf-api-2.x.x.jar and jsf-impl-2.x.x.jar files under the EAR/lib folder and verified the application runtime classpath to make sure it is not polluted with multiple JSF impls/versions.

Issue is seen only if the <prefer-application-resources> are defined in the META-INF/weblogic-application.xml in the EAR.

Issue is NOT seen if the <prefer-application-resources> are defined in the WEB-INF/weblogic.xml of the WAR.

Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms