Gotcha: web.xml in Spaces shared library

person Bijeshfolder_openWebCenterlocal_offer, , access_time August 26, 2011

This was a gotcha moment.

A colleague was attempting to create a custom taskflow for use in WebCenter Spaces. So this is what he did.

1) Deployed the custom taskflow as an ADF Library
2) Added the jar into the libraries of the WebCenterSpacesSharedLibExtension project and ensured the shared library deployment included it in the WAR.
3) Deployed the shared library to weblogic.
4) Deployed extend.spaces with the new library reference.

Everything went smoothly except the user couldn’t even get to the Login page anymore!! :-O The browser displayed the following

OracleJSP error: oracle.jsp.parse.JavaCodeException: Line # 6, oracle.jsp.parse.JspParseTagScriptlet@22e077e8
Error: Java code in jsp source files is not allowed in mode.

On looking at the log files there was this exception (see fullstack below) –

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory

This sounded a bit weird. How can a Faces factory class be missing in the WebCenter domain? After all, WebCenter uses ADF which is a Faces implementation. It was the most curious thing.  Now, I don’t have a proper explanation for this but the problem was caused by the fact that the web.xml in the shared library contained all the ADF and Faces related references – servlets, filters and the like.  

I can only hazard a guess – when weblogic tries to load the library reference (quite naturally this has to be done before the web application – Spaces, in this case – is initialized). Now, the shared library contains a web.xml that among other things defines servlets and filters that are Faces-related. So, weblogic attempts to load up the filters (the TrinidadFilter is of specific interest in the stacktrace). However, the shared library does not go through the Faces web application lifecycle and does not get initialized as a Faces application (meaning the ApplicationFactory didn’t get init-ed). Anyway, cleaning out the web.xml worked the magic.

Of course, we still have the question of what happened with the web.xml. If you look at the vanilla web.xml that ships with the WebCenterSpacesSharedLibExtension project, you will see that it has no Faces references and in fact, only references a custom servlet. What happened was this – when the ADF Library was added to the library references of WebCenterSpacesSharedLibExtension, JDeveloper in all helpfulness went ahead and configured the web.xml to add ADF support. Eeeks!!! A simple enough thing but took an hour or so to get to the “Duh!” moment.

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
        at javax.faces.FactoryFinder$FactoryManager.getFactory(
        at javax.faces.FactoryFinder.getFactory(
        at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.init(
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.init(
        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.init(
        at weblogic.servlet.internal.FilterManager$
        at weblogic.servlet.internal.FilterManager.loadFilter(
        at weblogic.servlet.internal.FilterManager.preloadFilters(
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(
        at weblogic.servlet.internal.WebAppServletContext.start(
        at weblogic.servlet.internal.WebAppModule.startContexts(
        at weblogic.servlet.internal.WebAppModule.start(
        at weblogic.application.internal.flow.ModuleStateDriver$
        at weblogic.application.utils.StateMachineDriver.nextState(
        at weblogic.application.internal.flow.ModuleStateDriver.start(
        at weblogic.application.internal.flow.ScopedModuleDriver.start(
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(
        at weblogic.application.internal.flow.ModuleStateDriver$
        at weblogic.application.utils.StateMachineDriver.nextState(
        at weblogic.application.internal.flow.ModuleStateDriver.start(
        at weblogic.application.internal.flow.StartModulesFlow.activate(
        at weblogic.application.internal.BaseDeployment$
        at weblogic.application.utils.StateMachineDriver.nextState(
        at weblogic.application.internal.BaseDeployment.activate(
        at weblogic.application.internal.EarDeployment.activate(
        at weblogic.application.internal.DeploymentStateChecker.activate(
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(


  1. Bijesh, again you helped me. Just keep following your trace, hope you keep your blog update


  2. Hi,

    I am facing the same problem how to clear and which web.xml file should be cleaned. could you tell me the steps to fix this problem

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>