I don't know about you, but I had all kind of strange errors working with
long time broker lives...

Now, I'm working as in mnemonic code:

public void xyzStore( XYZObject o ) {
  broker = getBroker();

  try {
      broker.store( o );
  } catch() {
  }finally {
    broker.close(); // this guarantees no mistakes...
  }

}

This guarantees that the broker object isn't spawned along threads... And my
code works fine!
Since the brokers are maintained in a pool, there is not pain in performance
(AFAIK).


Edson Richter


----- Original Message ----- 
From: "Bonnie MacKellar" <[EMAIL PROTECTED]>
To: "OJB Users List (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, July 07, 2003 5:20 PM
Subject: Weblogic, threads, and startup errors


I posted a question on Thursday about a mysterious error I am getting when I
try to obtain a broker in a thread spawned within my application. It was not
answered, perhaps because of the holiday, or perhaps because no one else is
doing what we are doing.

We are running a servlet based application in Weblogic. I am using rc2 at
the moment. As long as I obtain the broker in the main thread, there is no
problem. But if I spawn a new thread and try to obtain the broker, I was
getting obvious classpath problems - OJB.properties not found, and so forth.

I explicitly placed the classpath info for the app in my Weblogic startup
file (not good, but I will try anything right now). Doing this, it does find
the OJB.properties file, but now I get another odd error :

[BOOT] ERROR: The specified class
"org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" does not implement
the interface org.apache.ojb.broker.cache.ObjectCache, which is a
requirement for the key "ObjectCacheClass". Using default class
org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
java.lang.NullPointerException
        at dbtests.AccountUpdater.run(AccountUpdater.java:68)

Has anybody ever encountered this error before? Obviously, something goes
hideously wrong with the configuration of OJB once threads get into the
picture, but what? And again, I do not have this problem as long as the code
to obtain the broker is situated in the main thread.

thanks,
Bonnie MacKellar
software engineer
Mobius Management Systems, Inc.
[EMAIL PROTECTED]




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.497 / Virus Database: 296 - Release Date: 4/7/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to