Hello,

I have got a big problem with OJB (I think it is OJB),
I have an error : org.apache.ojb.broker.PBFactoryException: Borrow broker
from pool failed
This error comes after 1 or 2 days after the launch of the instance and
comes just after an update (after this error, we can do as select as we want
but we can't make another update). These updates work fine in the beginning
but after a moment (1 or 2 days), no.

I use OJB 0.9.7 with Struts, Oracle 9IAS 9.0.2 and Oracle 8i
In my application, I use ODMG API and PB API.
When I look in mail-archive, you purpose to close all the connections, this
is done with commitTransaction (for PB) or commit() (for ODMG)
Must I put PB.close() after all connections ?

Here is an example of use of ODMG :
TransactionImpl tx = null;

tx = (TransactionImpl) odmg.newTransaction();
tx.begin();

try {
        broker = tx.getBroker();

        UsrBO usrAM = new UsrBO();
        PropertyUtils.copyProperties(usrAM, user);
                        broker.store(usrAM);

        broker.clearCache();
        tx.commit();
} catch (Exception e) {
        log.error("Error", e);
        try {
                tx.abort();
        } catch (Exception ex) {
                log.error("Error 2");
        }

        throw new DatabaseException(e);
}

Here is an example of use of PB :
try {
        broker.beginTransaction();
        iterator = broker.getIteratorByQuery(query);
        broker.commitTransaction();
} catch (Exception ex) {
        log.error("Error", ex);
        try {
                broker.abortTransaction();
        } catch (Exception e) {
                log.error("Error 2");
        }
        throw new DatabaseException(ex);
}

Here is my logs :
497131214 ERROR [ApplicationServerThread-6]
service.PersistanceServicesImpl - Erreur lors de la cr�ation / modification
d'un utilisateur :
java.util.NoSuchElementException
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Unknown
Source)
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPersisten
ceBroker(Unknown Source)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unkno
wn Source)
        at org.apache.ojb.odmg.TransactionImpl.getBroker(Unknown Source)
        at
aphp.simpa.service.PersistanceServicesImpl.setUtilisateur(PersistanceService
sImpl.java:932)
        at aphp.simpa.action.LoginAction.perform(LoginAction.java:404)
        at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:244)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
        at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja
va:59)
        at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
        at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa
tcher.java:535)
        at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:281)
        at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.java:766)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:152)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
        at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
va:796)
        at java.lang.Thread.run(Thread.java:484)
rethrown as
org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPersisten
ceBroker(Unknown Source)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unkno
wn Source)
        at org.apache.ojb.odmg.TransactionImpl.getBroker(Unknown Source)
        at
aphp.simpa.service.PersistanceServicesImpl.setUtilisateur(PersistanceService
sImpl.java:932)
        at aphp.simpa.action.LoginAction.perform(LoginAction.java:404)
        at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:244)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
        at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja
va:59)
        at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
        at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa
tcher.java:535)
        at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:281)
        at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.java:766)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:152)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
        at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
va:796)
        at java.lang.Thread.run(Thread.java:484)
rethrown as
org.apache.ojb.broker.PersistenceBrokerException: Borrow broker from pool
failed
        at org.apache.ojb.odmg.TransactionImpl.getBroker(Unknown Source)
        at
aphp.simpa.service.PersistanceServicesImpl.setUtilisateur(PersistanceService
sImpl.java:932)
        at aphp.simpa.action.LoginAction.perform(LoginAction.java:404)
        at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:244)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
        at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja
va:59)
        at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
        at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa
tcher.java:535)
        at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:281)
        at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.java:766)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:152)
        at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
        at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
va:796)
        at java.lang.Thread.run(Thread.java:484)

And here is a part of my OJB.propoerties :
#---------------------------------------------------------------------------
-------------
# PersistenceBrokerFactory pool
#---------------------------------------------------------------------------
-------------
# PersistenceBroker pool configuration
# This pool uses the jakarta-commons-pool api.
# There you can find things described in detail.
#
# maximum number of brokers that can be borrowed from the
# pool at one time. When non-positive, there is no limit.
maxActive=20
#
# controls the maximum number of brokers that can sit idle in the
# pool (per key) at any time. When non-positive, there is no limit
maxIdle=-1
#
# max time block to get broker instance from pool, after that exception is
thrown.
# When non-positive, block till last judgement
maxWait=2000
#
# indicates how long the eviction thread should sleep before "runs" of
examining
# idle objects. When non-positive, no eviction thread will be launched.
timeBetweenEvictionRunsMillis=-1
#
# specifies the minimum amount of time that an broker may sit idle
# in the pool before it is eligable for eviction due to idle time.
# When non-positive, no object will be dropped from the pool due
# to idle time alone (depends on timeBetweenEvictionRunsMillis > 0)
minEvictableIdleTimeMillis=1000000
#
# specifies the behaviour of the pool when broker capacity is
# exhausted (see maxActive above)
# 0 - fail
# 1 - block
# 2 - grow
whenExhaustedAction=0
#
#
#---------------------------------------------------------------------------
-------------
# ConnectionFactory / Default ConnectionPool
#---------------------------------------------------------------------------
-------------
#
# The ConnectionFactoryClass entry determines which kind of
ConnectionFactory
# is to be used within org.apache.ojb as DEFAULT connection factory.
# A ConnectionFactory is responsible for creating
# JDBC Connections. Current version ships three implementations:
#
# 1. ConnectionFactoryDefaultImpl
#    No pooling, no playing around, be nice to your J2EE server.
#    Every connection request returns a new connection,
#    every connection release close the connection. Use this implementation
e.g if you
#    use Datasources from an application server.
# 2. ConnectionFactoryConPooledImpl
#    This implementation support connection pooling.
# 3. ConnectionFactoryStmtPooledImpl
#    This implementation support connection pooling and prepared statement
pooling.
# 4. ConnectionFactoryPassThroughImpl
#    Same as ConnectionFactoryDefaultImpl, but every con.commit() call
within OJB
#    was ignored by the connection. Use this implementation e.g if you
#    use Datasources from an application server.
#
# Use the OJB performance tests to decide, which implementation is best for
you.
# The proper way of obtaining a connection is configured in
# JDBCConnectionDescriptor entries in the repository.xml file.
# If want a more fine grained control of each connection pool used by OJB,
# take a look at the repository.dtd, there was a possibility to override
# this default connection factory entry in each JDBCConnectionDescriptor.
#
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryD
efaultImpl
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryCo
nPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryS
tmtPooledImpl
#ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryP
assThroughImpl
#
# Specifies maximum number of connections that can be borrowed from a
# connection pool at one time. When non-positive, there is no limit.
# If want a more fine grained control of each connection pool used by OJB,
# take a look at the repository.dtd.
maxConnectionsInPool=21
#
# Here you can set how OJB uses the autoCommit state of the used
connections. The default
# mode was 1. When using mode 0 or 2 with the PB-api, you must use PB
transaction demarcation
# 0 - OJB ignores the autoCommit setting of the connection and do not try to
change it.
#     This mode could be helpfully if the connection don't let you set the
autoCommit state.
#     (e.g. using datasources from application server)
# 1 - set autoCommit explicit 'true' when connection was created and
temporary
#     set to 'false' when necessary.
# 2 - set autoCommit explicit 'false' when connection was created.
useAutoCommit=1
#
# if true, exceptions caused by setting autocommit state, will be ignored
ignoreAutoCommitExceptions=false

Thanks for your help.


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

Reply via email to