ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lamey <cla...@localmatters.com>
Subject Re: SqlMapClientFactoryBean configuration
Date Tue, 17 Apr 2007 17:06:40 GMT
Hello,

WEB-INF is not part of a webapp's CLASSPATH.  The file needs to either
go in the WEB-INF/classes directory, or in a jar file in WEB-INF/lib.

Additionally, Spring might need the configLocation value to be
pre-pended with 'classpath:' in order to do what you want.  So it would
be something like this once the file is correctly in the CLASSPATH:

<property name="configLocation" value="classpath:SqlMapConfig.xml"/>

See the Spring documentation for further details.

Cheers,
Chris

On Tue, 2007-04-17 at 11:57 -0500, Mark Volkmann wrote:
> A SqlMapClientFactoryBean can be configured to read an  
> SqlMapConfig.xml file from the classpath using code like this.
> 
> Resource resource = new ClasspathResource("SqlMapConfig.xml");
> SqlMapClientFactoryBean smcFactory = new SqlMapClientFactoryBean();
> smcFactory.setConfigurationLocation(resource);
> 
> I can use Spring to create the factory with XML like this.
> 
>    <bean id="smcFactory"
>      class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
>      <property name="configLocation" value="/WEB-INF/SqlMapConfig.xml"/>
>      ...
>    </bean>
> 
> However, this doesn't read SqlMapConfig.xml from the classpath.
> Is there a way I can specify that the file should be read from the  
> classpath?

Mime
View raw message