Skip to Main Content

How to instantiate App Mod in bean not tied to a specific page or session

69084Oct 11 2002
I have come to the conclusion that I can't initialize the BC4J framework (e.g. initialize properties for the connection pool) until I create an instance of an App Mod. How can I do this in a static initializer block of a bean that is not tied to any particular page or user session or pageeContext?

I am trying to share the database connection pool across not only app modules but some of our pages that need to connect to the db but do not have app modules on them. But when I try to get the ConnectionPoolManager instance, it fails (UNLESS a page with an App Module on it was loaded first). If I try to get the instance first I get a nullpointer exception. Important note: I am in my own connection wrapper class so I do not have a session or pageContext.

I do this in my static initializer block of my class:
poolManager = ConnectionPoolManagerFactory.getConnectionPoolManager();
(this throws a null pointer exception)

and I've traced the error to this line in the ConnectionPoolManagerFactory getting null back:
String s = PropertyMetadata.PN_POOL_MANAGER.getProperty();

I suspect it is because the oracle.jbo.PropertyManager.loadProperties has not been run yet. The javadocs says: "This class is used at
framework initialization time to choose values for the various properties".

So, my questions are:

1) If I have to invoke an app mod instance to make this work....What's the simplest way to create an app mod instance from a bean that is
not tied to a session?

or 2)
1) Is there a way that I initialize the framework from my bean without instantiating an app module?
Post Details
Added on Oct 11 2002