ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: iBatis confusion about sqlMap
Date Tue, 19 Aug 2008 14:20:50 GMT
It should.  The classloader is a hierarchy.  For example, a simple one:

    Application (EAR)
        Web App (WAR)
    Web App (WAR)

The problem is that every one is different.  And JAR files totally mess
everything up. If you look up the class loader docs for WebLogic, JBoss and
WebSphere, you'll probably find more than you expect.

The best solution that seems to work on all app servers is to keep the
mapping files etc. in your /classes folder with your web app, rather than in
a JAR.

Also, you don't necessarily have to split out the sql-map-config.xml files,
you can keep the same one and just split out the properties file specified
in the <properties/> element of the sql-map-config.xml.

As another solution, if all else fails... load the properties file yourself
using the SqlMapClientBuilder.buildSqlMapClient(xmlResource,
propertiesInstance) overloaded method.  You can load the properties file
from the classpath using the Resources.getResourceAsProperties() method, and
if necessary you can specify the classloader explicitly.


On Tue, Aug 19, 2008 at 7:09 AM, Kram.V <v.kram@yahoo.com> wrote:

> Hi all,
>  I am an iBATIS newbie and love the ease of using it over Hibernate, but am
> having some issues here.
> I have a BaseDAO that intializes a sqlMap in a static way. This DAO is
> packaged in a jar and then bundled along with a war in a ear file and
> deployed. This works perfectly fine.
> Now, I have to use this same codebase for two different instances (2
> different websites). Each instance has its own database, so at build time I
> split out the sql-config-map.xml with respective datasources and bundled
> the
> applications as two different ear files. So now we have two different jars
> and two different wars bundled in their respective ear files.
> The problem that I am having is that the sqlMap keeps pointing to the same
> database instance in both these application deployments. Is there something
> that I am missing here, I thought each instance would get its own sql map
> especially since I provided a separate sql-map-config.xml file for each.
> Shouldn't each ear have its own class loader that would prevent any class
> loader issues? I am stumped.
> Thanks for your help in advance.
> --
> View this message in context:
> http://www.nabble.com/iBatis-confusion-about-sqlMap-tp19048358p19048358.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message