Hi,

It seems that when I load OJB, it doesn't automatically load the 
repository_database.xml file  that is in the build/resources folder on runtime. I've 
seen that OJB is able to work like that, but I don't want to do it on runtime, just 
use static xml config files.
Since i'm an absolute newbie, and I use Eclipse with defaults settings, is there 
anything special that I need to configure in order to make my program use the 
repository files ??

Any help will be appreciated,
Thanks in advance.

Sylvain.




I always create the broker in this way:

broker =
PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();

and I don't have problem, but I'm not an expert.

-----Mensaje original-----
De: Rajadurai K [mailto:[EMAIL PROTECTED] 
Enviado el: miércoles, 06 de octubre de 2004 11:58
Para: 'OJB Users List'
Asunto: RE: Need Help !

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.defaultPersi
sten
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.createPer
sist
enceBroker(PersistenceBrokerFactoryDefaultImpl.java:119)
    at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(P
ersi
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.createNewBro
kerI
nstance(PersistenceBrokerFactoryBaseImpl.java:87)
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl$PBKeyedPo
olab
leObjectFactory.makeObject(PersistenceBrokerFactoryDefaultImpl.java:238)
    at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Generic
Keye
dObjectPool.java:792)
    at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPer
sist
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.SequenceManagerHighLowImp
l"> 
            < 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.SequenceManagerNextValImp
l"> 
            < 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]




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


.

Reply via email to