You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Hiller, Frank RD-AS2" <Fr...@heidelberg.com> on 2005/06/13 19:57:51 UTC

Location of repository.xml

Hi,
 
I'm using OJB 1.0.3 with Tomcat 5.0.28.
In my servlet I set 
System.setProperty("OJB.properties",
"D:/jakarta-tomcat-5.0.28/webapps/MyWebAppConfig/OJB.properties");
Doing this loads OJB.properties without problems.
But "repository.xml" is not found though it is located in the same
directory.
 
OJB is trying to load this file from "D:/jakarta-tomcat-5.0.28/bin".
Strange....
 
Here' the error message.
 
- OJB Descriptor Repository:
file:/D:/jakarta-tomcat-5.0.28/bin/repository.xml
- Building repository from
:file:/D:/jakarta-tomcat-5.0.28/bin/repository.xml
- No repository.xml file found, starting with empty metadata and
connection configuration
- 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.
- Could not find org.apache.ojb.broker.metadata.JdbcConnectionDescriptor
for PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
password=null
- # finalize DescriptorRepository instance #
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.createPer
sistenceBroker(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.createPersis
tenceBroker(Unknown Source)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(U
nknown Source)
 
 
Thank you,
Frank


Re: Location of repository.xml

Posted by Danilo Tommasina <dt...@risksys.com>.
Hi,

In OJB.properties you can specify the location of the repository.xml. The default is just 'repository.xml' so that the file will be searched at the root of your
 classpath entries.

In this case java will try to load the repository.xml from your web-application classpath, then from the environment classpath, I guess that the directory '.'
is included in your classpath, this will be the directory where you started the JVM, in the case of your tomcat this is D:/jakarta-tomcat-5.0.28/bin/

You have two possiblities you can do it the dirty way (if you are just testing stuff) by setting the absolute path to the repository.xml in OJB.properties and
setting the path to OJB.properties in the System properties.
Or do it the 'good' way by just putting your OJB.properties and the repository.xml in the WEB-INF/classes of your web application without setting any System
properties or modifiing the default path to the respoitory.xml

bye
Danilo

> Hi,
>  
> I'm using OJB 1.0.3 with Tomcat 5.0.28.
> In my servlet I set 
> System.setProperty("OJB.properties",
> "D:/jakarta-tomcat-5.0.28/webapps/MyWebAppConfig/OJB.properties");
> Doing this loads OJB.properties without problems.
> But "repository.xml" is not found though it is located in the same
> directory.
>  
> OJB is trying to load this file from "D:/jakarta-tomcat-5.0.28/bin".
> Strange....
>  
> Here' the error message.
>  
> - OJB Descriptor Repository:
> file:/D:/jakarta-tomcat-5.0.28/bin/repository.xml
> - Building repository from
> :file:/D:/jakarta-tomcat-5.0.28/bin/repository.xml
> - No repository.xml file found, starting with empty metadata and
> connection configuration
> - 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.
> - Could not find org.apache.ojb.broker.metadata.JdbcConnectionDescriptor
> for PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
> password=null
> - # finalize DescriptorRepository instance #
> 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.createPer
> sistenceBroker(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.createPersis
> tenceBroker(Unknown Source)
>         at
> org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(U
> nknown Source)
>  
>  
> Thank you,
> Frank
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Location of repository.xml

Posted by Thomas Dudziak <to...@gmail.com>.
On 6/13/05, Hiller, Frank RD-AS2 <Fr...@heidelberg.com> wrote:

> I'm using OJB 1.0.3 with Tomcat 5.0.28.
> In my servlet I set
> System.setProperty("OJB.properties",
> "D:/jakarta-tomcat-5.0.28/webapps/MyWebAppConfig/OJB.properties");
> Doing this loads OJB.properties without problems.
> But "repository.xml" is not found though it is located in the same
> directory.

I'd suggest that you honor the location that the servlet spec suggests
for webapp configuration files, which is WEB-INF or - for resources
loaded from the classpath as OJB does - WEB-INF/classes. If you put
your files in there, OJB will find the files automatically (when using
the default configuration), and it will be guaranteed to be portable
across servlet containers.
 
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org