An updated version of H2 with Version 1.1.119 (2009-09-26) is now available in the repository.
P.
P.
| Poster | Content |
|---|---|
|
nk4um Moderator
Posts: 755
|
An updated version of H2 with Version 1.1.119 (2009-09-26) is now available in the repository.
P. |
|
nk4um Moderator
Posts: 755
|
Hi Chris,
Good work pushing this with the H2 team. I''m just doing some testing and will then post an update to the h2 package. P. |
|
nk4um User
Posts: 156
|
Hi guys,
The fix to this is included in 1.1.119 of h2. Cheers, Chris |
|
nk4um User
Posts: 156
|
Thanks for your help with this Tony. I have now added a comment and a patch to the issue tracker for h2 for this (http://code.google.com/p/h2database/issues/detail?id=112).
Cheers, Chris |
|
nk4um Moderator
Posts: 485
|
After discussing this with Chris offline, he created a patch which he has submitted back to H2, which causes it to use the
context classloader for loading these custom classes. On the NetKernel accessor side, we have made a change to set a request
scope classloader as the context classloader. This then enables H2 to resolve triggers from the application module(s) in the
request scope.
(This change will be in preview 6.7) Tony |
|
nk4um User
Posts: 156
|
Hi Tony,
Thanks for the information. I''ve dug into this a bit more and it looks like H2 is using Class.forName(className) (org.h2.util.ClassUtils.loadUserClass() - which is in the stack trace). Reading the javadocs, suggests that this is using this.getClass().getClassLoader() which the stack trace suggests is using org.netkernel.layer0.util.SpaceClassLoader. Any ideas on where to go with this next? Cheers, Chris |
|
nk4um Moderator
Posts: 485
|
Hi Chris,
I suspect it might be tricky. All the H2 classes will be loaded with the classloader in the RDBMS module. H2 will then be using that class loader either because it is the context classloader for the thread (most likely) or because it is using getClass().getClassLoader(). Either way that classloader doesn''t know about your modules classloader. If it is using the context classloader then it might be possible to patch the rdbms module to specify a request scope classloader for H2 to use. That way it could search for classes from in all modules in the request stack. (org.netkernel.layer0.util.RequestScopeClassLoader) Could you give this a try? If that sounds a bit hairy then I''ll try and have a look into it. Tony |
|
nk4um User
Posts: 156
|
Hi guys,
I''m using H2 as one of my database implementations, and am trying to add some Java triggers (http://www.h2database.com/html/features.html#user_defined_functions). However, the classloader isn''t able to find my class unless I remove the H2 jar file from the RDBMS module, and add it to mine (which isn''t a viable solution!). Any ideas how I can work around this? Cheers, Chris |