Re: What is the principle of the tccl (thread context class loader) in maven?

2011-07-12 Thread Brett Porter
That sounds like the right approach. I'm not sure how the TCCL is used in 
maven-3, but in Maven 2.x it was to set to the plugin's classloader just for 
the duration of the plugin execution, then restored.

- Brett

On 12/07/2011, at 10:33 AM, Benson Margulies wrote:

 The maven-jxr-plugin uses doxia-site-renderer. This, in turn, uses
 plexus-velocity, which in turn uses velocity version 1.5.
 
 So, you would think that it would be a piece of cake to make JXR use
 the same thing.
 
 But I got errors indicating that velocity was ending up with a class
 loader straddle and two copies of a critical interface in two class
 loaders.
 
 And, indeed, a bit of poking around, shows that (a) Velocity uses the
 thread context class loader to load the resource manager, and (b) that
 was set to some Realm or another, but not the one into which the
 plugin itself had been loaded. So, when Velocity explicitly asked to
 load the resource manager class into the tccl, it ended up with a
 second copy.
 
 So, I wrapped the call from the plugin into JXR itself in a
 try/finally to set and restore the tccl, and things worked.
 
 Is there something I'm missing?
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org
 

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter





-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



What is the principle of the tccl (thread context class loader) in maven?

2011-07-11 Thread Benson Margulies
The maven-jxr-plugin uses doxia-site-renderer. This, in turn, uses
plexus-velocity, which in turn uses velocity version 1.5.

So, you would think that it would be a piece of cake to make JXR use
the same thing.

But I got errors indicating that velocity was ending up with a class
loader straddle and two copies of a critical interface in two class
loaders.

And, indeed, a bit of poking around, shows that (a) Velocity uses the
thread context class loader to load the resource manager, and (b) that
was set to some Realm or another, but not the one into which the
plugin itself had been loaded. So, when Velocity explicitly asked to
load the resource manager class into the tccl, it ended up with a
second copy.

So, I wrapped the call from the plugin into JXR itself in a
try/finally to set and restore the tccl, and things worked.

Is there something I'm missing?

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org