ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Resource load problem
Date Tue, 29 Aug 2006 12:53:39 GMT
If you use a filename, it is no longer considered a resource.

You could use this, though:

String smcPath = System.getProperty("jboss.server.home.dir")
  + "/conf/SqlMapConfig.xml";
Resources.getUrlAsReader("file://" + smcPath);

Larry


On 8/29/06, Javier Leyba <xleyba@gmail.com> wrote:
> Hi
>
> I' ll use iBatis in my JBoss application and want to keep all
> configuration files in my conf directory so I did:
>
> static {
>                 try {
>                         String resource = System.getProperty("jboss.server.home.dir")
>                                                                 + "/conf/SqlMapConfig.xml";
>                         Reader reader = Resources.getResourceAsReader(resource);
>                         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                         throw new RuntimeException(
>                                         "Error initializing MyAppSqlConfig class. Cause:
" + e);
>                 }
>
>
> But when I call the application I get the error message:
>
> 12:52:06,764 INFO  [STDOUT] java.io.IOException: Could not find
> resource /home/jcm/jboss-4.0.3SP1/server/javier01/conf/SqlMapConfig.xml
>
> but if open a telent console and do
>
> vi /home/jcm/jboss-4.0.3SP1/server/javier01/conf/SqlMapConfig.xml from
> elsewhere I can open the file without problems.
>
> Any idea ?
>
> Thanks in advance
>
> J
>
>
> --
> Javier Leyba
> Barcelona - Spain
> http://blog.leyba.com.ar
>

Mime
View raw message