« Oracle JDeveloper 11g Technology Preview 4 Available | Main | Internet Explorer 7 Support »

Configuration Property: "MetaObjectManager" Scope


I have been working on a tricky case where the customer had developed a custom DBTransactionFactory, following instructions from the article "Creating and Using a Custom DBTransaction Implementation" from Steve Muench.

It was working fine and the application was correctly using the custom DBTransactionFactory.
However, after customer deployed another application in the same Web Container and also using its own custom DBTransactionFactory, he  noticed that the second application was using the same DBTransactionFactory (same class and same instance) as the first application.

After investigation, development pointed out that TransactionFactory has a MetaObjectManager scope, as shown when executing the following command:


java -cp <JDev_Home>BC4Jlibbc4jmt.jar oracle.jbo.common.PropertyManager

---------------------------------------------------------------
Business Components for Java - System Properties
---------------------------------------------------------------
Properties loaded from following sources, in order:
1. Client environment
2. Applet tags
3. -D flags (appear in System.properties)
4. bc4j.properties file (in current directory)
5. /oracle/jbo/BC4J.properties resource
6. /oracle/jbo/commom.jboserver.properties resource
7. /oracle/jbo/common.Diagnostic.properties resource
8. System defined default
---------------------------------------------------------------
...
TransactionFactory MetaObjectManager (M)public Internal
...
---------------------------------------------------------------

As explained in the JDeveloper online help, topic "Understanding Configuration Property Scopes":

...
You'll see each property is listed with one of the following scopes:

* MetaObjectManager
   Properties at this scope are initialized once per Java VM when the ADF PropertyManager is first initialized.
...
If
you leave any MetaObjectManager-scoped properties in your bc4j.xcfg
files, you will have the undesirable behavior that they will take on
the value specified in the configuration of the first application
module whose pool gets created after the Java VM starts up.
...



We could force each application using its own version of TransactionFactory by adding code to the latter part of each ApplicationModuleImpl.

In Application 1, that should use CustomDatabaseTransactionFactory1, f.ex.:

...

static

{
   oracle.jbo.server.DatabaseTransactionFactory.setFactory(new CustomDatabaseTransactionFactory1());

}
In Application 2, that should use CustomDatabaseTransactionFactory2, f.ex.:

...

static

{
   oracle.jbo.server.DatabaseTransactionFactory.setFactory(new CustomDatabaseTransactionFactory2());

}

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on May 19, 2008 11:05 AM.

The previous post in this blog was Oracle JDeveloper 11g Technology Preview 4 Available.

The next post in this blog is Internet Explorer 7 Support.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle