Here is the release of JavaLoader, version 0.5.
It pretty much does exactly the same thing that the previous versions
did,
however, it now works in ColdFusion 8, when the setting 'Disable access
to internal ColdFusion Java components' is turned on, as it uses its
own JavaProxy CFC, which may often be turned on on shared hosts.
That's really about it, nothing more interesting than that.
Download JavaLoader v0.5 from here.
Comments
it is a must
Hi there, this looks like a useful utility. To completely isolate Java code loaded via the NetworkClassloader, I would suggest considering investigating changing the lookup algorithm in NetworkClassloader so that it looks first at itself before delegating to the parent. This would allow using versions of jars that might conflict with the core CF libraries (we have run into this with Axis jars). Along with this you may want to set the Thread contextClassLoader for each call, so any loaded framework code itself will use the correct classloader. This can probably be done by simply setting the context classloader to the networkclassloader in the JavaProxy prior to each invocation, and resetting/unsetting it afterwards. Going through a wrapper like JavaProxy is handy in this way.
I am having problems forcing the javaloader to use a different version of iText than the one in the cf libraries. Is there any way to force the loader to not use the version in the cf lib?
@Freddy just tell JavaLoader to load up without the CF classpath (which it does by default), and then you have your separation.
That is how I am calling it. However when I use
loadPaths = ArrayNew(1);
loadPaths[1] = ExpandPath("itext-2.0.4.jar");
loader = createObject("component", "javaloader.JavaLoader").init(loadPaths);
document = loader.create("com.lowagie.text.Document").init();
WriteOutput("iText Version from loader = "& document.getVersion() & "<br><br>");
document.close();
document = createObject("java","com.lowagie.text.Document").init();
WriteOutput("iText Version normal = "& document.getVersion()& "<br><br
document.close();
It gave me the following result:
iText Version from loader = iText by lowagie.com (r1.02b;p128)
iText Version normal = iText by lowagie.com (r1.02b;p128)
This is on cf7 and it is possible that the class path information is non-standard in these installs. On cf8 on my dev server the javaloader worked as advertised.
Thanks
@Freddy, you should you are using JavaLoader 0.5?
I am using the 0.5 version