Maybe this is a synchronization problem? Try to use a synchronized block (or method) for the critical section (db.open()).
cheers, Thomas > -----Urspr�ngliche Nachricht----- > Von: Jose Thomas [mailto:joset@;in.ibm.com] > Gesendet: Mittwoch, 6. November 2002 15:02 > An: [EMAIL PROTECTED] > Betreff: Problem with open data base in a servlet environment > > > Hi, > I am using odmg api with ojb version 0.9.5 in our project > > I have a base PersistanceContext class which has static > Implementation and Database instances. > The odmg instace is initialized by the OJB.getInstance() and > the database is opened using > odmg.newDatabase at the > intialization. > > Then in the begin transaction method beofre each transaction > is created > and started, a database.open with the repository file name is done. > The exception generated is caught and ignored in the case of > a Database > already open exception. > Then the transaction is created and begun using the following > two lines > tx = odmg.newTransaction() ; > tx.begin() ; > > What happens is that after a few invocations I get the > following exception > [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U > (EMBusiness > 224 ) Error Opening Database : ignoring - Database is > already open > > [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U > [org.apache.ojb.odmg.TransactionImpl] WARN: > [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U > TransactionImpl > created with null DatabaseImpl. > [11/6/02 19:09:11:108 GMT+05:30] 39850c47 SystemOut U > (EMBusiness > 224 ) Error while beggining transaction null > java.lang.NullPointerException > > The problem is that just before the warning and exception > caused due to > the null databse, I get the database already open exception which is > caught and ignored, when trying to open the database. This > database open > statement is the statement just before the new and begin transaction > statements that causes the exception. I just cant understand > how these two > can happen together. Can anyone tell me what I am doing wrong. > > Thanks in advance. > > Regards Jose > -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
