logo       


Re: Is this possible in iBatis?: msg#00350

Subject: Re: Is this possible in iBatis?
Yes, the properties element will let you use either a resource or a
URL as the location of the properties file.

A resource is loaded from the class loader and as such, needs to be on
the class path. In a web application, you could put it in a jar in
your WEB-INF/lib directory, or in a directory in WEB-INF/classes, and
the class loader will find it. Resource examples include
"com/company/system/config/ibatis.propertes" or just simple
"ibatis.properties" instead.

A URL is loaded with the URLConnection class, so any URL that Java is
aware of will work in iBATIS. For example,
"jar:file:/somedir/config.jar!/ibatis-dev.properties". If you really
had a need, you could even use
"http://somehost/config/somefile.properties";, and iBATIS would
dutifully load the properties from that URL.

You need to find the appropriate URL, and it will work.

Larry

On Tue, 25 Jan 2005 12:57:28 -0000, Adrian Harrison
<adrianharrison_uk@xxxxxxxxxxx> wrote:
> I have an EAR (PRDApp) containing several EJB's & a single WAR file.
> 
> I have a prd.system.properties file that currently contains the data source
> name iBatis use's to get a connection from a Weblogic connection pool.
> 
> i.e
> 
> datasourcename=PRDDataSource
> 
> So my sql-map-config.xml file looks something like this -
> 
>         <sqlMapConfig>
> 
>                 <properties resource = "prd.system.properties" />
> 
>                 .
>                 .
>                 <transactionManager type="EXTERNAL">
>                         <dataSource type="JNDI">
>                                 <property name="DBFullJndiContext"
> value="${datasourcename}"/>
>                         </dataSource>
>                 </transactionManager>
> 
> This works fine but I want to use this file to contain other settings used
> by other modules. So I've placed it in the App directory but changing the
> line to -
> 
>         <properties resource = "./applications/PRDApp/system.properties" />
> 
> but this produces -
> 
>         javax.ejb.EJBException: Error in ejbCreate::
> java.lang.ExceptionInInitializerError
>         .
>         Caused by: java.lang.RuntimeException: Could not initialize
> DaoConfig.  Cause:      com.ibatis.dao.client.DaoException: Error while
> configuring DaoManager.  Cause:
> com.ibatis.sqlmap.client.SqlMapException: There was an error while building
> the SqlMap instance.
>         --- The error occurred in
> ./applications/PRDApp/prd.system.properties.
>         --- The error occurred while loading global properties.
>         --- Cause: com.ibatis.sqlmap.client.SqlMapException: Error loading
> properties.  Cause:     java.io.IOException: Could not find resource
> ./applications/PRDApp/prd.system.properties
>         .
> 
> Is it possible to get iBatis to use this file? if so any ideas what the
> resource line should be?
> 
> Many thanks
> 
> harry
> 
>



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe