These are no good since the loadClass method of java.lang.ClassLoader always 
calls the parent classloader first, which finds the version of OSCache from 
CF's core runtime libs.

I will make a modification to the JavaLoader.cfc to accomplish this as follows:

1) Make a custom Java subclass to URLClassLoader called 
com.foo.something.MyURLClassLoader
2) use JavaLoader.cfc and in its init() method use the regular URLClassLoader 
to load the ClassLoader subclass defined in step 1, and give it the set of 
URL's in the constructor, just as we did with the regular 
java.net.URLClassLoader

3) call setURLClassLoader(myNewClassLoaderImpl) so the internal class loader is 
our new subclass.

----

The overridden methods in MyURLClassLoader will be :

public Class loadClass(String name)
    throws ClassNotFoundException
    {
        return loadClass(name,false);
    }

 protected synchronized Class loadClass(String name, boolean resolve) throws 
ClassNotFoundException{
              // First, check if the class has already been
              // loaded by this classloader (returns null if not loaded, or 
              // loaded by anyone else
        Class c = findLoadedClass(name);
        if (c == null) {
            try {
                c = findClass(name);
            } catch(ClassNotFoundException v){
                // defer to parent, but this time AFTER I get a chance!
                //  default behavior is to delegate to parent first.
                c=getParent().loadClass(name);
            }
        }
        if (resolve) {
            resolveClass(c);
        }
        return c;
    }


-----

Does anyone see a reason why something like this wouldn't work?

I wont have time to play with this until this evening, just wanted to outline 
my steps as a sanity check.

Thanks!
Dov

The actual ClassLoader I 
its existing URLClassLoader to load the custom class
3) Seth

> You need to use a trick like this:
> 
> http://www.compoundtheory.com/?action=javaloader.index
> 
> or this:
> 
> http://www.spike.org.uk/blog/index.cfm?do=blog.
> entry&entry=B49509DF-D565-E33F-31C9E574EA1591EE
> 
> On 1/1/07, Dov Katz <[EMAIL PROTECTED]> wrote:
> > Is this nothining more than using the classpath as defined in the CF 
> Admin, or is there something I'm missing. With tomcat, this type of 
> thing is easy, but I'm not sure where in the CF admin / server 
> architecture I could designate certain libs to be loaded for access by 
> my apps...
> 
> -- 
> CFAJAX docs and other useful articles:
> http://www.bifrost.com.
au/blog/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265472
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to