hi all,
this isn't a bug or issue, just a question if someone has solved a
similar problem or info for someone who has a similar problem.
i switched to putting a spring xml config into my component and
configuring it from there (mainly because i'm using hibernate and i
wanted to use the spring transaction management which seems a lot
easier using a spring beans configuration rather than hand cranking
it).
unit testing went well, but i ran into all sorts of classloading
issues when deploying the component. essentially, it looks like if i
load spring from servicemix, it can't see classes loaded by the
component. this looks to be a reflection problem:
Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:160)
at org.springframework.beans.factory.support.AbstractBeanDefinition.reso
lveBeanClass(AbstractBeanDefinition.java:308)
using either:
context.setClassLoader(getClass().getClassLoader());
or
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
doesn't seem to make a difference.
if i switch to self-first and put the spring jar into the component, i
need to add a bunch of other jars in that are part of the default
servicemix lib (e.g. xbean, activemq, exclude xml-api's, derby). these
are all jars that the component uses so it might not be a bad thing
from a jbi container portability point of view BUT because i'm using
hibernate, i need an easy way to allow people to dump new database
drivers into servicemix and it would be preferable if they could put
them into the servicemix/lib folder rather than either creating a
shared library component or rebuilding my component with them in.
my current plan is to rip out the spring-beans config and hand crank
it (which i prefer in all honesty but is going to be a bit of a PITA).
cheers,
j.