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 ojsp.next 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(FactoryFinder.java:725)
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239)
        at oracle.adfinternal.view.faces.config.rich.FacesDatabindingConfigurator._setupAdfDatabindingForJsf(FacesDatabindingConfigurator.java:122)
        at oracle.adfinternal.view.faces.config.rich.FacesDatabindingConfigurator.init(FacesDatabindingConfigurator.java:53)
        at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.init(GlobalConfiguratorImpl.java:399)
        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.init(RegistrationFilter.java:53)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.init(TrinidadFilterImpl.java:110)
        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.init(TrinidadFilter.java:54)
        at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:332)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:98)
        at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:59)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1876)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)

Comments

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

    Cheers,

  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>