hi,

   I think U have to increase the maxActive in Ojb.properties. can u do that
and verify. Basically that error says that it can't able to get the
connection from pool.


Rajadurai

-----Original Message-----
From: Sylvain Juge [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 06, 2004 1:18 PM
To: ojb-user
Subject: Need Help !



I'm trying to use OJB API, and especially Object Persistance, but it
doesn't work.

I can build without any errors, the database schema is properly
generated and executed on the RDBMS (MySQL).
I've tried with default configuration files provided in ojb-blank, thus
using embedded database, and I get exactly the same results.

When I try to use PersistanceBroker, I've got two problems :

-- I get an error because there's no default PBKey when I try to get the
default Broker :

    broker = PersistenceBrokerFactory.defaultPersistenceBroker()

    results in :

    Exception in thread "main" org.apache.ojb.broker.PBFactoryException:
There was no default-PBKey specified
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
ceBroker(PersistenceBrokerFactoryBaseImpl.java:157)
    at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Pers
istenceBrokerFactory.java:65)
    at PBSample.storeProduct(PBSample.java:19)
    at Application.run(Application.java:37)
    at Application.main(Application.java:28)

-- When I try to use a specific PBKey created by hand :

    initially PersistenceBrokerFactory.getDefaultKey() returns null

        PBKey pbk = new PBKey("localmysql","root","");
        broker = PersistenceBrokerFactory.createPersistenceBroker(pbk);

       results in :

Exception in thread "main" org.apache.ojb.broker.PBFactoryException:
Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey:
jcdAlias=localmysql, user=root, password=*****
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist
enceBroker(PersistenceBrokerFactoryDefaultImpl.java:119)
    at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Persi
stenceBrokerFactory.java:86)
    at PBSample.storeProduct(PBSample.java:25)
    at Application.run(Application.java:37)
    at Application.main(Application.java:28)
Caused by: org.apache.ojb.broker.PBFactoryException: Given PBKey
org.apache.ojb.broker.PBKey: jcdAlias=default, user=root, password=*****
does not match in metadata configuration
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.createNewBrokerI
nstance(PersistenceBrokerFactoryBaseImpl.java:87)
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl$PBKeyedPoolab
leObjectFactory.makeObject(PersistenceBrokerFactoryDefaultImpl.java:238)
    at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeye
dObjectPool.java:792)
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist
enceBroker(PersistenceBrokerFactoryDefaultImpl.java:100)
    ... 4 more

However, the repository_database.xml file (in build/ressources), seems
to be well configurated, here is the file :

jdbc-connection-descriptor
           jcd-alias="localmysql"
           default-connection="true"
           platform="MySQL"
           jdbc-level="3.0"
           driver="com.mysql.jdbc.Driver"
           protocol="jdbc"
           subprotocol="mysql"
           dbalias="//localhost/proj1"
           username="root"
           password=""
           batch-mode="false"
        useAutoCommit="1"
        ignoreAutoCommitExceptions="false"
     >

        <object-cache
class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
            <attribute attribute-name="timeout" attribute-value="900"/>
            <attribute attribute-name="autoSync" attribute-value="true"/>
            <attribute attribute-name="cachingKeyType" attribute-value="0"/>
        </object-cache>

        <connection-pool
            maxActive="21"
            validationQuery="@VALIDATION_QUERY@"
            testOnBorrow="@TEST_ON_BORROW@"
            testOnReturn="@TEST_ON_RETURN@"
        />

        <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
            <attribute attribute-name="grabSize" attribute-value="20"/>
            <attribute attribute-name="autoNaming" attribute-value="true"/>
            <attribute attribute-name="globalSequenceId"
attribute-value="false"/>
            <attribute attribute-name="globalSequenceStart"
attribute-value="10000"/>
        </sequence-manager>
   </jdbc-connection-descriptor>

   <!-- Datasource example -->
    <!-- jdbc-connection-descriptor
        jcd-alias="default"
           platform="Hsqldb"
           jdbc-level="2.0"
           jndi-datasource-name="java:DefaultDS"
           username="sa"
           password=""
        eager-release="false"
        batch-mode="false"
        useAutoCommit="0"
        ignoreAutoCommitExceptions="false"
   >
        <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
            <attribute attribute-name="autoNaming" attribute-value="true"/>
        </sequence-manager>

   </jdbc-connection-descriptor -->


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

Reply via email to