Hi St�phane, On Wed, Aug 28, 2002 at 04:51:30PM +0200, Stephane Felten wrote: > hi, > I am using OJB0.9.5 in a webapp running on tomcat. I am not using the J2EE >persistance broker but the default one. I am getting an Error since the >TransactionImpl are created with a null Database. > The db is open and exists, I can use it for queries but some times when I try to get >a new transaction, I am getting an Error. > Is this because I am not using the J2EE broker? I am using OJB since a few month and >I never got this problem, do the new release impose the use of the J2EE mode? > > The LogMessage I get is the following : > > [org.apache.ojb.odmg.TransactionImpl] WARN: TransactionImpl created with null >DatabaseImpl. > > The Error I get is the following : > > "java.lang.NullPointerException > at org.apache.ojb.odmg.TransactionImpl.getBroker(Unknown Source)"
This error seems to occur in multithreaded environments only. The Database instances are stored in a ThreadLocal (pbKeysForThread in OJB.java), so when your request is processed in a different thread the still opened Database instance is not found. There was a posting by Andrey Chernyh on August 21st containing a patch to OJB.java giving you a method to register your Database instance with the current thread. Seems to work fine for me so far... hope this helps, Jens -- Jens Kr�mer [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
