Gotcha: web.xml in Spaces shared library

WebCenter No Comments »

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)

WebCenter Portal Security

Oracle, PS3, WebCenter No Comments »

In the default WebCenter Portal generated by JDeveloper, anonymous-role is granted “view” privilege on the home page. This may not always be desirable. The portal may not have any public content to put on the home page. In my current project, the entire portal has to be secured and available only to authenticated users. You would imagine this is a straight-forward thing to achieve but it’s not.

To turn off access to home page, I edited the page hierarchy and removed the grants assigned to anonymous-role. Now, when the user attempts to access /faces/oracle/webcenter/portalapp/pages/home.jspx, the user gets redirected correctly to the login page. However, if the user were to use the pretty url /pages_home the server throws a 404 error (perhaps an incorrectly flagged 403?) and the user is left with a very unhelpful error page. The trouble with this is that the user may choose to bookmark after his/her initial login and that bookmark will invariably point at the pretty URL.

There is also another side-effect to this. When the user hits logout, webcenter redirects the user to the current page after logout. Given that faces-config.xml contains a “logout_success” navigation case, I imagined that changing this to point at, say, the login page would work. Alas no. The only way to make this work was to change the Logout link to a goLink with the destination set to “adfAuthentication?logout=true&end_url=\faces\oracle\webcenter\portalapp\pages\login.jspx”.

Oh and this is w.r.t WebCenter 11.1.1.5.

Update: Thanks to Andrejus for an excellent workaround. His technique to solve the Session time-out problem can be applied here too.

(BUG) WCS PS3: Copying the WebCenter FX skin

Oracle, PS3, WebCenter No Comments »

When you copy the WebCenter FX skin, the copied skin doesn’t work as expected. Without any changes to the copy, I would expect the skin to render the same as WebCenter FX but it doesn’t. My guess is that the copied skin doesn’t inherit properly from the internal base skin used by WebCenter FX. The only way to overcome this is to copy the contents of the internal skin css into the copied skin. Read the rest of this entry »

WCS PS3: Custom Skin Images

Oracle, PS3, WebCenter No Comments »

With Webcenter PS3, Oracle offers something they term “Round-trip Development” using JDeveloper. Simply put, this enables you to

a) download resources from WebCenter Spaces to JDeveloper
b) edit or extend the resources in JDeveloper
c) Directly upload the resources to the server.
Read the rest of this entry »

WebCenter Spaces: Quirks, Bugs, Workarounds

WebCenter No Comments »

Documenting some of the quirks, bugs and workarounds in WebCenter Spaces. These apply to PS2. Read the rest of this entry »

WebCenter Spaces: Removing the profile (username) tab (contd.)

WebCenter 9 Comments »

Contd from here.

I’ve managed to solve this. Thanks to the Oracle support note 1068828.1, we looked at MDS customizations as an option. It’s still a bit of a hack but works for our case. Read the rest of this entry »

(BUG) ADF BC validation messages in WebCenter Spaces

ADF, WebCenter 2 Comments »

Another bug? Validation messages from the ADF BC layer don’t display correctly within Webcenter Spaces. Instead of the custom validation message that’s setup in the BC layer, Spaces always displays “Unexpected error(s) occurred. You may want to contact Administrator with the error reference.” The error-ed fields are flagged correctly though. I have raised an SR with Oracle for this. I am told that Webcenter Spaces considers any Exception outside of the oracle.webcenter package to be an unexpected error. I am waiting to see if Oracle gets back with a feasible workaround. Hmmm!

Given that ADF taskflows are a recommended way to extend webcenter spaces, I find this limitation, well, very limiting.

WebCenter Spaces: The people connections tab

WebCenter No Comments »

SOLVED – here.
You may have seen the default tab that Webcenter Spaces displays – the one titled with the logged in username. This tab originates from the People Connections service and contains sub-tabs like “Gallery”, “Activity Stream”, “Message Board”, etc.

People Connections Tab

People Connections Tab

In my current project, there is a requirement to not display this tab. There does not seem to be any admin option to turn off this tab. Nor does the people connections tab (and also the Personal Space tab) allow the “Close this tab” option. If you use the “Maximised” site template, of course, the primary tab is displayed at one level below and so the PC tab does not show but neither do other group space tabs. That isn’t a workable solution either.

As a last option, I decided to dig into the webcenter application to see what was going on under the wraps. Turns out the tab is hard-wired into the menu model used by WC Spaces. What’s more, the application explicitly leaves out the “Close this tab” option. The only way I see to disable this tab (unless Oracle decides it’s useful and release a patch to enable this feature) is to create a custom site template, create a dummy menu model accessor in a custom bean and use this as the model for the tabs. In the menu model accessor, retrieve the built-in menu model “#{o_w_w_i_v_s_tabManager.menuModel}” and manipulate it at run-time. It isn’t as easy as it sounds. The roadblocks -

  1. Getting all the required class libraries containing the webcenter spaces classes. The key classes needed are WebCenterShellMenuModel, WebCenterShellTabModel
  2. Finding a way to actually manipulate the menu model
  3. Making the whole thing upgrade/patch proof.
  4. Most importantly, figuring out the copyright/legal implications of using the Webcenter application classes and manipulating an internal object.

I seem to have sorted 1 out. I am working on 2 during my off hours. First step of 2 is to actually identify the entry for this tab, retrieve it at run time and examine its properties.

Custom ADF Task Flows and the Spaces resource catalog

ADF, WebCenter 8 Comments »

Note: This is a very roughly put-together guide. I will spend some time in cleaning this up later.

I had someone ask for help on deploying a task flow to WebCenter Spaces and exposing it through a resource catalog. Here’s a quick run-through of how I do it. I will explain the essential building blocks and you should be able to implement it any way you like.

What you’ll need

1) Read the “Extending WebCenter Spaces” whitepaper on OTN.

2) Download the sample project that supplements the whitepaper.

Both these can be downloaded from OTN here. The easiest way to expose custom ADF task flows is to use the sample project and the ANT build file it contains. You can always customize the project to fit your requirements.

Building Blocks

1. Shared ADF Library

  1. Develop your ADF Taskflow and create an ADF Library out of it.
  2. Create a new WAR file (let’s call it custom-taskflow.war) including the ADF library jar(s) from step 1 in the WEB-INF/lib of the WAR. Optionally include a manifest to name your extension and setup version info.
  3. Deploy the WAR to the weblogic server to the WLS_Spaces and AdminServer managed server as a shared library. Note the deployed library’s name from the WLS Admin Console.

2. WebCenter Spaces Customisation

To expose the custom task flow in the Spaces catalog, you have to create and deploy a customisation shared library – “custom.webcenter.spaces”. The Webcenter Spaces installation should already contain a base version of this library.

Here we create and deploy a WS customisation that makes the task flow available on the Spaces catalog. You may choose to add the task flow to either the default personal catalog or the group spaces catalog.

  1. From the whitepaper sample project, copy the resource catalog required. You’ll find them in the path SourceFiles\catalog\oracle\adf\rc\metadata\scopedMD\defaultScope
  2. Edit the xml file and add your custom task flow to the resource catalog. To obtain the correct entry for your task flow
    1. Create a file system connection to the folder containing your ADF Library Jar (from Step 1a)
    2. Navigate to the task flow entry in the file system connection
    3. Right clock on the task flow and choose the option “Show Catalog Reference”
    4. You can copy the entire XML tag that shows up in the dialog.
    5. Optionally you can add attributes to this – title, description, etc for your task flow. See the entries already present in the source catalog for reference.
  3. Create a jar that contains the resource catalog. The path to the catalog in the JAR should be custom\oracle\adf\rc\metadata\scopedMD\defaultScope
  4. Create a WAR file to deploy this as a shared library. A few important points to note on this
    1. The WAR should contain the JAR from 2c in WEB-INF/lib
    2. The WAR should contain a weblogic.xml with a library reference entry pointing to the deployment name from 1C.
    3. The WAR should contain a manifest file that specifies the following mandatorily (See the sample project for reference)
      Extension-Name: custom.webcenter.spaces
      Specification-Version: <the specification version of the default custom.webcenter.spaces library>
      Implementation-Version: <an implementation version higher than the current deployment>
  5. Deploy the WAR file as a shared library to the WLS_Spaces and AdminServer managed servers.
  6. Redeploy the webcenter application on WLS_Spaces for the changes to take effect.

Oracle WebCenter Spaces

WebCenter 9 Comments »

I am building an enterprise portal on Oracle WebCenter for a client. The client requires quite a few custom portlets that enable their business functions. The plan is to build these custom applications using Oracle ADF as individual task flows that may later be consumed either by WebCenter Spaces or by a custom WebCenter application.

Extending WebCenter Spaces is no fun at all. The only resource to help integrate customizations into spaces is the Oracle Whitepaper – Extending WebCenter Spaces. To be honest, integrating into Spaces could end up being the most frustrating part of the whole process.

I have spent a few days now trying the custom project that accompanies the WebCenter Spaces. The default settings for deployment work extremely well. My first point of trouble was when I tried to undeploy the customizations. Once I did that, the Spaces app began to throw exceptions all over the place. It was looking for metadata related to a template that existed in the sample war – the custom war that I “undeployed”. Figured out that WebLogic wasn’t cleaning up correctly after an “undeploy”. I had to manually delete the caches to get Spaces back to its default. Details here.

The second point of trouble was when I wanted to deploy only the custom resource catalog from the sample project. I didn’t have the need for any of the other customizations, so I followed the whitepaper instructions on removing whatever I did not need. The project builds fine and deploys fine. Unfortunately, Spaces began to throw up a different set of exceptions. The user error simply says “Error occurred in getting the complete list of pages you can access. Please contact the administrator.” without saying anything useful. The actual exceptions in the log are ClassCastExceptions and NPEs.

After a lot of unnecessary detours, I have now managed to integrate a custom ADF task flow into the Personal Catalog on Spaces. The taskflow is deployed on the server as a shared library.

I shouldn’t have to create a custom version of a WAR to simply consume an application in the portal. I’m told that the next release of WebCenter (PS3) will make customizations and skinning easier. Keeping fingers crossed!

Self Note: Useful Links

- Managing Portlet Producers
- Adding Portlets to pages

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in