I tried patching FileSystemDisk to use
Thread.currentThread().getContextClassLoader().getResourceAsStream()
but it didn't work... I guess this classloading problem is a bit more
complicated than expected...

On May 3, 5:05 pm, Xavier <[email protected]> wrote:
> Hi,
>
> I'm actually using H2 + Hibernate and I'm importing some data through
> Hibernate's import.sql (which is executed after tables have been
> created).
>
> When I have this in my import.sql:
>
> insert into files (id, name, content) values (1, 'logo.png',
> FILE_READ('classpath:logo.png'));
>
> I get an exception like this one at deployment time:
>
> java.io.FileNotFoundException: resource /logo.png
>         at
> org.h2.store.fs.FileSystemDisk.openFileInputStream(FileSystemDisk.java:
> 374)
>         at org.h2.util.IOUtils.openFileInputStream(IOUtils.java:710)
>         at org.h2.expression.Function.getValueWithArgs(Function.java:
> 1137)
>
> because H2 drivers (which live in the application server classpath)
> can't see my application classpath (and can't find the resource
> 'logo.png').
>
> So would it be possible to have another parameter for FILE_READ (or
> another procol like threadClasspath:) to instruct I want the resources
> to be read through
> Thread.currentThread().getContextClassLoader().getResourceAsStream()
> instead of FileSystemDisk.class.getResourceAsStream() ? Do you think
> it would solve my problem ?
>
> Thanks,
>
> Xavier

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to