As it turns out, method ResourceLoaderFactory.getLoader was already modified to use the thread context classloader. Using a snapshot from yesterday (with no modification), the problem goes away!

Thanks to all who participated in this discussion and fix... very enlightening.

Is there a tutorial or article that covers this topic (class-loading in the app-server environment)?

Thanks,
Steve


Stephen Morris wrote:

I'm having a similar problem with Velocity (1.4) being able to instantiate a custom resource loader [see stack trace below].

Would the fix to class
   ClasspathResourceLoader
fix this problem also if applied to class:
org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader ?

Thanks,
Steve



Error is: java.lang.ClassNotFoundException: blah.blah.blah.MyCustomResourceLoader
       at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:141)
at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:79) at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:185) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:502) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:268) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:441) at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:148)


Shinobu Kawai wrote:

Hi max,

Any particular reason why velocity only do Class.forName() where
it should first look in thread context classloader and THEN do
Class.forName() ?

(it gives some issues when running in environments with changing
classloaders, like
J2EE and Eclipse)


Are we talking about the ClasspathResourceLoader?  Then it's fixed in
the latest repository.
 http://issues.apache.org/bugzilla/show_bug.cgi?id=22419
For the latest in the repository:
 http://cvs.apache.org/snapshots/velocity/

Best regards,
-- Shinobu

--
Shinobu Kawai <[EMAIL PROTECTED]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to