java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory

大兔子大兔子 提交于 2019-12-31 02:26:06

问题


I have upgraded application to use javax.faces-2.2.4 and primefaces-4.0 jars.After deploying my application to weblogic from myeclipse I am getting below error:

Jan 10, 2014 2:37:13 PM javax.faces.FactoryFinder$FactoryManager getFactory
SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.
Jan 10, 2014 2:37:13 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. 
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:140)
    at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:310)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:482)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.EventsManager.notifyContextDestroyedEvent(EventsManager.java:200)
    at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletContext.java:3225)
    at weblogic.servlet.internal.ServletContextManager.destroyContext(ServletContextManager.java:247)
    at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:461)
    at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.java:1545)
    at weblogic.servlet.internal.WebAppModule.deactivate(WebAppModule.java:509)
    at weblogic.application.internal.flow.ModuleStateDriver$2.previous(ModuleStateDriver.java:387)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:215)
    at weblogic.application.internal.flow.ModuleStateDriver.deactivate(ModuleStateDriver.java:141)
    at weblogic.application.internal.flow.ScopedModuleDriver.deactivate(ScopedModuleDriver.java:206)
    at weblogic.application.internal.flow.ModuleListenerInvoker.deactivate(ModuleListenerInvoker.java:261)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$2.previous(DeploymentCallbackFlow.java:547)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:215)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(DeploymentCallbackFlow.java:192)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(DeploymentCallbackFlow.java:184)
    at weblogic.application.internal.BaseDeployment$2.previous(BaseDeployment.java:677)
    at weblogic.application.utils.StateMachineDriver.previousState(StateMachineDriver.java:223)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:63)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:59)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Even ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext ) method has not been called


回答1:


java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.

One of more common causes of this exception is that the webapp's runtime classpath is polluted with multiple different JSF API versions which are colliding/confusing each other.

This is likely also the case in your case. Weblogic itself already ships with JSF bundled, however you're supplying another one along with your webapp. So effectively you end up with two different versioned JSF APIs in the webapp's runtime classpath.

I don't do Weblogic, but basically you have 2 options:

  1. Tell Weblogic to not load its bundled JSF, so that effectively only the webapp-bundled JSF is loaded.
  2. If you intend to upgrade Weblogic's bundled JSF version, then don't upgrade it via your webapp, but directly in Weblogic itself. Or perhaps, upgrade the whole server to a newer version if the desired JSF API version is incompatible with the Servlet version of the server (JSF 2.2 requires Servlet 3.0).

Consult its admin documentation for clues.




回答2:


You only needs to clean build and deploy this new build on weblogic



来源:https://stackoverflow.com/questions/21040515/java-lang-illegalstateexception-could-not-find-backup-for-factory-javax-faces-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!