Thomas,
        Thanks for the response. That didn't solve the problem but I circumvented 
the problem in a different way. But the root problem that made me confront 
this still exists. The problem is as follows.

As explained earlier the environment is OJB Version 0.9.5 with odmg apis. 
This is running in WSAD/WAS 4.0 with DB2 7.2

I have a instance level ODMG Instance and database variables which are 
initialized at instance level using  OJB.getInstance() and 
odmg.newDatabase()

Again per thread  a database.open( repositoryFile, 
Database.OPEN_READ_WRITE ) is done and a corresponding database.close is 
done for this using a clean up function in the process layer. But we find 
the following message in the log file
Already created persistence broker instances: 1 intermittently and the 
instance number goes up. Finally at some point of time the application 
blocks trying to get a new broker instance.

We have ensured that here is a Database.close call for every Database.open 
call. In the code we use the broker API using the following code and for 
list operations
            tx = context.getOdmg().currentTransaction();
            PersistenceBroker broker = ((HasBroker) tx).getBroker();

Here alone we are not releasing the broker. Should we release the broker 
in this case also or will odmg take care of releasing the broker.

I looked through the Database.open code of OJB and found that there is a 
broker.close call in the finally block of that code.

I couldn't find any place in our code where there could be a broker leak.

Would you be able to throw some light on this.

Thanks
                                        Jose





Mahler Thomas <[EMAIL PROTECTED]>
11/06/2002 07:38 PM
Please respond to "OJB Users List"

 
        To:     "'OJB Users List'" <[EMAIL PROTECTED]>
        cc: 
        Subject:        AW: Problem with open data base in a servlet environment

 

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>



Reply via email to