Do you have "repoistory_internal.xml" as well? Or did you just miss this out
from the list below?

Daniel.

> -----Original Message-----
> From: Phillip Blevins [mailto:[EMAIL PROTECTED]
> Sent: 02 December 2004 16:13
> To: OJB Users List
> Subject: Re: OJB can't open database
>
>
> Tom,
>
> for my web app
>
> Under  WEB-INF/classes  i have
> repository.dtd
> repository.xml
> repository_database.xml
> repository_user.xml
> OJB.properties
>
> I belive that it is finding  them there because if i remove
> OJB.properties it complaines.
> under lib direcorie I've got the db-ojb-1.0.1.jar
> for the web application I don't get as extensive exceptions, I get the
>   "Database is NULL, must have a DB in order to create a transaction".
>
> Thanks
>
> On Thu, 02 Dec 2004 16:14:24 +0100, Thomas Dudziak
> <[EMAIL PROTECTED]> wrote:
> > Phillip Blevins wrote:
> >
> >
> >
> > >Greetings,
> > >
> > >I keep getting an error stating that "OJB can't open database".
> > >However I'm sure the repository.xml file is in the classpath. I've put
> > >several evenings into to figuring this out and am unable to find a
> > >solution. It seems like it is unable to find the repository.xml file.
> > >I initially try this in a Struts project but I thought that maybe that
> > >fact that some of the depended libraries were a higher version then
> > >what came with the 1.0.1 download that this might be messing things
> > >up. I then moved it to a two class project in eclipse and added all
> > >the libraries that came with OJB 1.0.1, and I received the same error.
> > >
> > >Thanks for any Help!
> > >Phillip Blevins
> > >
> > >here is my connection code
> > > public static void storeCountry()
> > >{
> > >  CountryVO cc = new CountryVO();
> > >  cc.setArms(10);
> > >  cc.setArtisans(10);
> > >  cc.setDefense(11);
> > >  cc.setName("Chi Chan");
> > >  cc.setNumber(10);
> > >
> > >    Implementation odmg = OJB.getInstance();
> > >Database db = odmg.newDatabase();
> > >
> > >  try{
> > >      //db.open("default#pblevins#friend", Database.OPEN_READ_WRITE);
> > >      //db.open("repository.xml", Database.OPEN_READ_WRITE);
> > >     db.open("default", Database.OPEN_READ_WRITE);
> > >    }catch (ODMGException ex){
> > >      ex.printStackTrace();
> > >   }
> > >
> > >/* ... use the database ... */
> > >
> > >try{
> > >Implementation impl = OJB.getInstance();
> > >Transaction tx = impl.newTransaction();
> > >tx.begin();
> > >tx.lock(cc, Transaction.WRITE);
> > >tx.commit();
> > >
> > >db.close();
> > >  }catch (org.odmg.ODMGException ee){
> > >     ee.printStackTrace();
> > > }
> > >}
> > >
> > >This Would be my error:
> > >
> > >(core.PersistenceBrokerFactoryDefaultImpl ?   ) Create
> > >PersistenceBroker instance pool, pool configuration was
> > >{whenExhaustedAction=0, maxIdle=-1, maxActive=100, maxWait=2000,
> > >removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false,
> > >minEvictableIdleTimeMillis=1000000, testOnReturn=false,
> > >logAbandoned=false, removeAbandonedTimeout=300,
> > >timeBetweenEvictionRunsMillis=-1, testOnBorrow=false}
> > >(metadata.RepositoryPersistor        ?   ) OJB Descriptor Repository:
> > >file:/C:/Program%20Files/eclipse3.0/workspace/TSSt/bin/repository.xml
> > >(metadata.RepositoryPersistor        ?   ) Building repository from
> > >:file:/C:/Program%20Files/eclipse3.0/workspace/TSSt/bin/repository.xml
> > >(metadata.MetadataManager            ?   ) No repository.xml file
> > >found, starting with empty metadata and connection configuration
> > >(metadata.MetadataManager            ?   ) No 'default-connection'
> > >attribute set in jdbc-connection-descriptors, thus it's currently not
> > >possible to use 'defaultPersistenceBroker()'  convenience method to
> > >lookup PersistenceBroker instances. But it's possible to enable this
> > >at runtime using 'setDefaultKey' method.
> > >(metadata.ConnectionRepository       ?   ) Could not find
> > >org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey
> > >org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
> > >password=null
> > >(odmg.DatabaseImpl                   ?   ) Open database failed:
> > >Borrow broker from pool failed, using PBKey
> > >org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
> > >password=null
> > >org.apache.ojb.broker.PBFactoryException: Borrow broker from pool
> > >failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default,
> > >user=null, password=null
> > >        at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.cre
> atePersistenceBroker(Unknown
> > >Source)
> > >        at
> org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBr
> oker(Unknown
> > >Source)
> > >        at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
> > >        at CountryDA.main(CountryDA.java:33)
> > >Caused by: org.apache.ojb.broker.PBFactoryException: Given PBKey
> > >org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
> > >password=null does not match in metadata configuration
> > >        at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.create
> NewBrokerInstance(Unknown
> > >Source)
> > >        at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl$PBK
eyedPoolableObjectFactory.makeObject(Unknown
> > >Source)
> > >        at
> org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(G
enericKeyedObjectPool.java:792)
> > >        ... 4 more
> > >org.odmg.DatabaseNotFoundException: OJB can't open database default
> > >Borrow broker from pool failed, using PBKey
> > >org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
> > >password=null
> > >        at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
> > >        at CountryDA.main(CountryDA.java:33)
> > >org.odmg.DatabaseClosedException: Database is NULL, must have a DB in
> > >order to create a transaction
> > >        at
> org.apache.ojb.odmg.ImplementationImpl.newTransaction(Unknown Source)
> > >        at CountryDA.main(CountryDA.java:42)
> > >Exception in thread "main"
> > >
> > >
> >
> > The error states that OJB could not find the repository.xml file on the
> > classpath, so check its position: for a webapp put it into
> > WEB-INF/classes along with OJB.properties and also don't put OJB into
> > the server's shared lib folder but into the WEB-INF/lib folder of your
> > webapp.
> >
> > Tom
> >
> > ---------------------------------------------------------------------
> > 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]
>
>


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

Reply via email to