You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Härtel, Eric <E....@d-trust.net> on 2007/09/12 17:30:59 UTC

ressource and properties path

Hello list,

I´m new to iBatis and got some problems with the properties and resource location. 

In my standalone application have a config directory beside the classpath, where all configuration (log4j, Ibatis a.s.o.) should stay together. But the loading of the properties file "<properties  resource="SqlMapConfig.properties" />" does not work. In the example the files are stored in classpath location, but I don´t want to do so.

With the "<sqlMap resource="config/SqlMap_Order.xml" />" I got the same problem. 

regards, Eric

Re: ressource and properties path

Posted by Larry Meadors <lm...@apache.org>.
Why not just add a "conf" directory to the classpath? Then you can
keep the config files there, and use the class loader...

Larry


On 9/14/07, Härtel, Eric <E....@d-trust.net> wrote:
> Thanks for your hint, I have overlooked the second 'buildSqlMapClient' methode, the one with the properties. I have no problem to put the mapping into the classpath. But I want to configure the database host etc. without to open a jar file.
>
> solved!
>
> > -----Original Message-----
> > From: larry.meadors@gmail.com
> > [mailto:larry.meadors@gmail.com] On Behalf Of Larry Meadors
> > Sent: Friday, September 14, 2007 2:31 PM
> > To: user-java@ibatis.apache.org
> > Subject: Re: ressource and properties path
> >
> > There are 3 ways to provide a properties object:
> >
> > 1) class path resource
> > 2) url (file:///absolute/path/to/my.properties)
> > 3) in code (Properties p = new Properties();)
> >
> > IMO, keeping them on the class path is the simplest approach.
> >
> > Larry
> >
> >
> > On 9/14/07, Härtel, Eric <E....@d-trust.net> wrote:
> > > May be I didn´t ask a concrete question. How do I locate a
> > properties file outside the classpath?
> > >
> > > greetings
> > >
> > > > -----Original Message-----
> > > > From: Härtel, Eric [mailto:E.Haertel@d-trust.net]
> > > > Sent: Wednesday, September 12, 2007 5:31 PM
> > > > To: user-java@ibatis.apache.org
> > > > Subject: ressource and properties path
> > > >
> > > > Hello list,
> > > >
> > > > I´m new to iBatis and got some problems with the properties
> > > > and resource location.
> > > >
> > > > In my standalone application have a config directory beside
> > > > the classpath, where all configuration (log4j, Ibatis a.s.o.)
> > > > should stay together. But the loading of the properties file
> > > > "<properties  resource="SqlMapConfig.properties" />" does not
> > > > work. In the example the files are stored in classpath
> > > > location, but I don´t want to do so.
> > > >
> > > > With the "<sqlMap resource="config/SqlMap_Order.xml" />" I
> > > > got the same problem.
> > > >
> > > > regards, Eric
> > >
> >
>

RE: ressource and properties path

Posted by Härtel, Eric <E....@d-trust.net>.
Thanks for your hint, I have overlooked the second 'buildSqlMapClient' methode, the one with the properties. I have no problem to put the mapping into the classpath. But I want to configure the database host etc. without to open a jar file.

solved!

> -----Original Message-----
> From: larry.meadors@gmail.com 
> [mailto:larry.meadors@gmail.com] On Behalf Of Larry Meadors
> Sent: Friday, September 14, 2007 2:31 PM
> To: user-java@ibatis.apache.org
> Subject: Re: ressource and properties path
> 
> There are 3 ways to provide a properties object:
> 
> 1) class path resource
> 2) url (file:///absolute/path/to/my.properties)
> 3) in code (Properties p = new Properties();)
> 
> IMO, keeping them on the class path is the simplest approach.
> 
> Larry
> 
> 
> On 9/14/07, Härtel, Eric <E....@d-trust.net> wrote:
> > May be I didn´t ask a concrete question. How do I locate a 
> properties file outside the classpath?
> >
> > greetings
> >
> > > -----Original Message-----
> > > From: Härtel, Eric [mailto:E.Haertel@d-trust.net]
> > > Sent: Wednesday, September 12, 2007 5:31 PM
> > > To: user-java@ibatis.apache.org
> > > Subject: ressource and properties path
> > >
> > > Hello list,
> > >
> > > I´m new to iBatis and got some problems with the properties
> > > and resource location.
> > >
> > > In my standalone application have a config directory beside
> > > the classpath, where all configuration (log4j, Ibatis a.s.o.)
> > > should stay together. But the loading of the properties file
> > > "<properties  resource="SqlMapConfig.properties" />" does not
> > > work. In the example the files are stored in classpath
> > > location, but I don´t want to do so.
> > >
> > > With the "<sqlMap resource="config/SqlMap_Order.xml" />" I
> > > got the same problem.
> > >
> > > regards, Eric
> >
> 

Re: ressource and properties path

Posted by Larry Meadors <lm...@apache.org>.
There are 3 ways to provide a properties object:

1) class path resource
2) url (file:///absolute/path/to/my.properties)
3) in code (Properties p = new Properties();)

IMO, keeping them on the class path is the simplest approach.

Larry


On 9/14/07, Härtel, Eric <E....@d-trust.net> wrote:
> May be I didn´t ask a concrete question. How do I locate a properties file outside the classpath?
>
> greetings
>
> > -----Original Message-----
> > From: Härtel, Eric [mailto:E.Haertel@d-trust.net]
> > Sent: Wednesday, September 12, 2007 5:31 PM
> > To: user-java@ibatis.apache.org
> > Subject: ressource and properties path
> >
> > Hello list,
> >
> > I´m new to iBatis and got some problems with the properties
> > and resource location.
> >
> > In my standalone application have a config directory beside
> > the classpath, where all configuration (log4j, Ibatis a.s.o.)
> > should stay together. But the loading of the properties file
> > "<properties  resource="SqlMapConfig.properties" />" does not
> > work. In the example the files are stored in classpath
> > location, but I don´t want to do so.
> >
> > With the "<sqlMap resource="config/SqlMap_Order.xml" />" I
> > got the same problem.
> >
> > regards, Eric
>

RE: ressource and properties path

Posted by Härtel, Eric <E....@d-trust.net>.
May be I didn´t ask a concrete question. How do I locate a properties file outside the classpath?

greetings 

> -----Original Message-----
> From: Härtel, Eric [mailto:E.Haertel@d-trust.net] 
> Sent: Wednesday, September 12, 2007 5:31 PM
> To: user-java@ibatis.apache.org
> Subject: ressource and properties path
> 
> Hello list,
> 
> I´m new to iBatis and got some problems with the properties 
> and resource location. 
> 
> In my standalone application have a config directory beside 
> the classpath, where all configuration (log4j, Ibatis a.s.o.) 
> should stay together. But the loading of the properties file 
> "<properties  resource="SqlMapConfig.properties" />" does not 
> work. In the example the files are stored in classpath 
> location, but I don´t want to do so.
> 
> With the "<sqlMap resource="config/SqlMap_Order.xml" />" I 
> got the same problem. 
> 
> regards, Eric