Hi Thomas

I don't know, but perhaps this helps:

http://www.websina.com/bugzero/kb/oracle-connection.html

This was one problem in our installation.

An other problem could be that some Broker stay open after use. I had this
behavior in my tomcat-application. After I checked the code where a
PersistenceBroker is used and implemented the call of the close method
correctly at the end of any request (also if it throws an exception!), it
works fine.


regards

Roland Ribi                          

-----Original Message-----
From: Thomas Franke [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 11, 2004 11:00 AM
To: OJB Users List
Subject: Re: validation query for connection failed


Armin Waibel wrote:

> which version of OJB do you use?
We still use db-ojb-1.0.rc6 but we are going to use the current realease.

> Normally ConnectionFactoryPooledImpl tries 100 times to lookup a valid 
> connection from the DB, so you should get the warning several times 
> before the pool break.
> Could you post the whole stack trace?

Here it is:

-----------------------------begin

[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] WARN: 
Validation query for connection failed, discard connection. Query was 
select count(*) from datenklasse, Message was E/A-Exception: Socket closed
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] WARN: 
Validation query for connection failed, discard connection. Query was 
select count(*) from datenklasse, Message was E/A-Exception: Socket closed
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] WARN: 
Validation query for connection failed, discard connection. Query was 
select count(*) from datenklasse, Message was E/A-Exception: Socket closed
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: 
PersistenceBrokerException during the execution of the query: Used 
ConnectionManager instance could not obtain a connection
Used ConnectionManager instance could not obtain a connection
org.apache.ojb.broker.PersistenceBrokerException: Used ConnectionManager 
instance could not obtain a connection
        at 
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unkn
own 
Source)
        at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown 
Source)
        at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown 
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
Source)
        at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn
own 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow
n 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unkn
own 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unkn
own 
Source)
        at de.mhr.wis.DBAdapter.ojbAdapter.Utils.getWea(Utils.java:627)
        at 
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogbuchAdapter.importStatusdat
en(OjbLogbuchAdapter.java:392)
        at 
de.mhr.wis.businessLayer.logic.management.LogBook.importStatusdaten(LogBook.
java:879)
        at 
de.mhr.wis.businessLayer.facades.rawdata.RawDataFacade.importStatusdaten(Raw
DataFacade.java:50)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portStatus(MitaImporter.java:723)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portSingleRawFile(MitaImporter.java:358)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portRawFile(MitaImporter.java:249)
        at 
de.mhr.wis.communicationlayer.communicationmanager.RawFileManager.run(RawFil
eManager.java:221)
Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not 
borrow connection from pool - 
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: 
[EMAIL PROTECTED]
   jcd-alias=default
   default-connection=true
   dbms=Oracle9i
   jdbc-level=2.0
   driver=oracle.jdbc.driver.OracleDriver
   protocol=jdbc
   sub-protocol=oracle
 
db-alias=thin:@(description=(address=(host=xxx.xx.x.xxx)(protocol=tcp)(port=
1521))(connect_data=(sid=xxx)(server=dedicated)))
   user=xx
   password=*****
   eager-release=false
   ConnectionPoolDescriptor={whenExhaustedAction=1, 
validationQuery=select count(*) from datenklasse, maxIdle=10, 
maxActive=41, maxWait=20000, removeAbandoned=false, 
numTestsPerEvictionRun=10, testWhileIdle=true, 
minEvictableIdleTimeMillis=-1, testOnReturn=false, logAbandoned=false, 
removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, 
testOnBorrow=true}
   batchMode=false
   useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
   ignoreAutoCommitExceptions=false
 
[EMAIL PROTECTED]
      sequenceManagerClass=class 
org.apache.ojb.broker.util.sequence.SequenceManagerOracleSequenceImpl
      Properties={autoNaming=true, globalSequenceId=false, 
globalSequenceStart=10000, grabSize=20}
]
]
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionF
romPool(Unknown 
Source)
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnec
tion(Unknown 
Source)
        at 
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Unknow
n 
Source)
        ... 18 more
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
        at 
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo
l.java:801)
        ... 21 more
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: 
PersistenceBrokerException during the execution of the query: Used 
ConnectionManager instance could not obtain a connection
Used ConnectionManager instance could not obtain a connection
org.apache.ojb.broker.PersistenceBrokerException: Used ConnectionManager 
instance could not obtain a connection
        at 
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unkn
own 
Source)
        at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown 
Source)
        at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown 
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
Source)
        at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn
own 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow
n 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unkn
own 
Source)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unkn
own 
Source)
        at de.mhr.wis.DBAdapter.ojbAdapter.Utils.getWea(Utils.java:627)
        at 
de.mhr.wis.DBAdapter.ojbAdapter.management.OjbLogbuchAdapter.importStatusdat
en(OjbLogbuchAdapter.java:392)
        at 
de.mhr.wis.businessLayer.logic.management.LogBook.importStatusdaten(LogBook.
java:879)
        at 
de.mhr.wis.businessLayer.facades.rawdata.RawDataFacade.importStatusdaten(Raw
DataFacade.java:50)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portStatus(MitaImporter.java:723)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portSingleRawFile(MitaImporter.java:358)
        at 
de.mhr.wis.communicationlayer.communicationmanager.importers.MitaImporter.im
portRawFile(MitaImporter.java:249)
        at 
de.mhr.wis.communicationlayer.communicationmanager.RawFileManager.run(RawFil
eManager.java:221)
Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not 
borrow connection from pool - 
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: 
[EMAIL PROTECTED]

---------------------------end

and so on.


Is the information enough or do you need any more?

Thanks for help!

regards

Thomas


>> Hello there,
>>
>> Our application should work twenty-for seven. Suddenly an exception 
>> occurs. This exception isn't caught in the application, instead I see 
>> it on the console. (At the moment we start the application from the 
>> console).
>>
>> For example I see:
>>
>> ... WARN: Validation query for connection failed.
>> ...
>>
>> Nested Exception
>>
>> unexpected end of input stream
>>
>> ...
>>
>>
>>
>> After that the application doesn't work anymore. It seems like I can 
>> no longer establish a connection to the database. The only way to get 
>> the application running again is the comlete new start.
>>
>> We use the following classes:
>>
>> -----------------------begin
>>
>>
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPo
oledImpl 
>>
>>
>>
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerIm
pl 
>>
>>
>> -----------------------end
>>
>>
>> The repository.xml looks like this for example:
>>
>> --------------------------begin
>>
>>    <class-descriptor
>>          class="de.softenery.wis.mydata"
>>          table="mydata"
>>    >
>>       <field-descriptor id="1"
>>          name="id"
>>          column="mydata_id"
>>          jdbc-type="INTEGER"
>>          primarykey="true"
>>          autoincrement="true"
>>          access="readonly"
>>       />
>>       <field-descriptor id="2"
>>          name="weaId"
>>          column="w_id"
>>          jdbc-type="INTEGER"
>>       />
>>       <field-descriptor id="22"
>>          name="modifikation"
>>          column="modifikation"
>>          jdbc-type="TIMESTAMP"
>>          conversion="de.mhr.wis.DBAdapter.ojbAdapter.Calendar2Timestamp"
>>       />
>>       <field-descriptor id="23"
>>          name="timestamp"
>>          column="zeitstempel"
>>          jdbc-type="TIMESTAMP"
>>          conversion="de.mhr.wis.DBAdapter.ojbAdapter.Calendar2Timestamp"
>>       />
>>    </class-descriptor>
>>
>> ---------------end
>>
>> The repository_database.xml looks like this:
>>
>> ------------------begin
>>
>>     <jdbc-connection-descriptor
>>            jcd-alias="sow"
>>            default-connection="true"
>>            platform="MySQL"
>>            jdbc-level="2.0"
>>            driver="org.gjt.mm.mysql.Driver"
>>            protocol="jdbc"
>>            subprotocol="mysql"
>>            dbalias="//192.99.90.199:3306/sow"
>>            username="gogo"
>>            password="45jdkekdl"
>>         eager-release="false"
>>            batch-mode="false"
>>         useAutoCommit="1"
>>         ignoreAutoCommitExceptions="false"
>>      >
>>
>>         <connection-pool whenExhaustedAction="2" maxActive="21" 
>> validationQuery="select count(*) from datenklasse" />
>>
>>         <sequence-manager
>>
>>
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl"> 
>>
>>         </sequence-manager>
>>    </jdbc-connection-descriptor>
>>
>> ---------------end
>>
>>
>> And the code looks like this:
>>
>> ----------------------begin
>>
>> try {
>>             broker = PersistenceBrokerFactory.defaultPersistenceBroker();
>>             broker.beginTransaction();
>>
>> [...]
>>             broker.getObjectByQuery(query);
>> [...]
>>
>>                 broker.store(data);
>>             }
>>             broker.commitTransaction();
>>
>>         } catch (TransactionInProgressException e) {
>>             logger.error(e);
>>         } catch (TransactionAbortedException e) {
>>             logger.error(e);
>>         } catch (TransactionNotInProgressException e) {
>>             logger.error(e);
>>         } catch (PBFactoryException e) {
>>             logger.error(e);
>>         } catch (PersistenceBrokerException e) {
>>             logger.error(e);
>>         } catch (Exception e) {
>>             logger.error(e);
>>         } finally {
>>             if (broker != null) {
>>                 broker.clearCache();
>>                 broker.close();
>>             }
>>         }
>>
>>
>>
>> ----------------end
>>
>> Can anyone give me any help on this?
>>
>> regards
>>
>> Thomas



-- 
Mit freundlichen Grüßen

Thomas Franke

Geschäftsführer softEnergy GmbH
----------------------------
The energy for a better world
----------------------------
softEnergy GmbH
Platz der Freundschaft 1
18059 Rostock
----------------------------
fon: +49 381 40 587 535
fax: +49 381 40 587 555
mobil: +49 1715222015

http://www.softenergy.de
mail: [EMAIL PROTECTED]
----------------------------

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


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

Reply via email to