On Mon, Jan 25, 2010 at 22:15, Charles Galpin <cgal...@lhsw.com> wrote: > Hi Andreas > > I tried setting the TCCL to both the class loader of the service context as > well as the service group context before starting the threaD, but still no > change. I guess this leaves me with a couple of questions. > > 1. Do subsequent threads spawned inherit the same TCCL? I'm pretty sure other > threads are spawned by this thread which then go on to do the work.
I think that the constructor of java.lang.Thread takes over the TCCL from the current thread. The Javadoc of java.lang.Thread should give a detailed explanation of this. > 2. How can I tell what class loader is being used? Just log whatever > this.getClassLoader() returns anywhere I care? Thread.currentThread().getContextClassLoader() (not to be confused with Class#getClassLoader()) > 3. Is init perhaps the wrong place to be firing this off? I originally tried > in the startUp method but iirc member variables initialized here were not > retained when the service methods were invoked. Unfortunately I'm not familiar enough with the lifecycle methods to answer that question. > > thanks, > charles > > On Jan 25, 2010, at 3:57 PM, Andreas Veithen wrote: > >> Charles, >> >> That might actually explain the issue. Here is some additional info: >> >> * ORB.init looks up classes from the thread context class loader (I >> checked that in the JRE sources). >> * ServiceTCCL=composite means that Axis2 sets the TCCL to the service >> class loader when entering a service method and resets it after the >> method exits. >> * A new thread that is being created inherits the TCCL from its parent >> thread (see Javadoc of java.lang.Thread). >> >> However, it is possible that Axis2 doesn't take the ServiceTCCL >> property into account when executing a lifecycle method (maybe that >> should be considered as a bug). This would mean that your thread ends >> up with the TCCL set to the Web app class loader. Since the thread is >> managed by your service, you can obviously set the TCCL for that >> thread to whatever you want (It will have no impact on Axis2 nor on >> the servlet container). I would try to set it to the service class >> loader (You should be able to get a reference to that class loader >> from the parameters passed to the lifecycle method). >> >> Andreas > >