Disclaimer: This may be no help at all, but - yes I have seen it before. IIRC it is a class loader problem. If you do a search I am pretty sure Mark discussed the issue in a thread about xml parsing (maybe?).
-Leigh
I gave that a shot, using the code below:
paths = directoryList(expandPath("lib"), false, "array");
writeDump(paths);
_thread = createObject("java", "java.lang.Thread");
currentClassLoader = _thread.currentThread().getContextClassLoader();
try{
jl = createObject("component", "javaloader.Javaloader").init(paths);
_thread.currentThread().setContextClassLoader(jl.getURLClassLoader());
wb = jl.create("org.apache.poi.xssf.streaming.SXSSFWorkbook").init(100);
} catch( any exc ){
rethrow;
} finally{
_thread.currentThread().setContextClassLoader(currentClassLoader);
}
But when I do that, I get this weird one:
Object Instantiation Exception.
Class not found: coldfusion.runtime.java.JavaProxy
The error occurred in
C:\dev\projects\wwwroot\javaloader\javaloader\JavaLoader.cfc: line 329
Called from C:\dev\projects\wwwroot\javaloader\javaloader\JavaLoader.cfc:
line 87
Called from C:\dev\projects\wwwroot\sandbox\poi\poi_xsff_example.cfm: line 13
Called from C:\dev\projects\wwwroot\javaloader\javaloader\JavaLoader.cfc:
line 329
Called from C:\dev\projects\wwwroot\javaloader\javaloader\JavaLoader.cfc:
line 87
Called from C:\dev\projects\wwwroot\sandbox\poi\poi_xsff_example.cfm: line 13
327 : <cfargument name="class" hint="the java class to create the
proxy with" type="any" required="Yes">
328 : <cfscript>
329 : return createObject("java",
"coldfusion.runtime.java.JavaProxy").init(arguments.class);
330 : </cfscript>
331 : </cffunction>
IT's as if overwriting the current class loader causes CF to lose its mind.
Marc
Thanks again for the guidance, everyone. Ya'll rock.
Quick answer - you can still put it in the server scope, just be sure to use this approach when you first set it up, and I'm pretty sure you should be good from then on.
Mark
Sent from this mobile doohickey.
Longer answer - dom4j sets up it's singletons on first load (or as a static block, I forget), and once it's done, you don't need to worry about it anymore - so you can still
>> One of these days I will submit a patch to dom4j to fix this issue.... really, I will. |
If it helps, I am sure it would make a lot of people very happy ;-) |