Thanks for the info. The idea I'm starting to get here is that there really isn't a built in method like JavaLoader in CF 10. With JavaLoader, I can be very specific - load up a jar into the server scope and access it whenever I choose. If I understand this correctly, CF 10 gives us the ability to load jar files - but in doing so, they can override the built in ones, which would in fact surely break a tag or two in the case of POI. I think that leaves me back to using JavaLoader, which I'm OK with. The only problem I have is I can't figure out how to make it work in CF 10. I have taken the classloader jar file and put in cfusion/lib and bounced CF. It shows up as a valid class, and I can create objects with it like so:

<cfobject type="java" class="com.compoundtheory.classloader.NetworkClassLoader" name="test">

However, when I run my usual JavaLoader code, it bombs. The code is:

<cfif NOT structKeyExists(server, var.JLKey)>
<cfset server[var.JLKey] = createObject("component", "component.JavaLoader").init(loadPaths=var.paths, loadColdFusionClassPath=true) />
</cfif>

When running this code, specifically line 211 of JavaLoader.cfc throws this exception:

java.lang.ClassNotFoundException: com.compoundtheory.classloader.NetworkClassLoader at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at

Has anyone seen this with CF 10 and been able to work around it?

On 9/20/12 10:10 PM, Douglas Knudsen wrote:
IIRC, Java will search class paths in order and uses the first match it finds. So, I'm thinking since CF starts up, loads the built-in POI jars, then eventually sees your app and loads the Jars again, albeit newer versions, then this new version is lower in the 'order' The disclaimer here is that I'm not a JAR head by trade :) I think you could add the Jar in the CFAdmin tool, restart CF, then check the JVM details and see if your JAR is higher in the order, it should be. Might need to add this JAR in the jam.config manually though. (I left that typo in, SpaceBalls! ) ok, jvm.config. EIther of these might affect the CF tags using POI though.

A classic post on adding Jars is below, though I'd start with http://carehart.org/cf411/ first :)
http://blogs.adobe.com/cantrell/archives/2004/07/the_definitive.html


HTH

Douglas Knudsen
[email protected] <mailto:[email protected]>



On Sep 20, 2012, at 7:11 PM, Mike Staver <[email protected] <mailto:[email protected]>> wrote:

I can't find any good documentation from Adobe yet on how to dynamically load and then use jar files. I previously used JavaLoader, and after fixing the class load issues I had in code, it worked flawlessly for the past few years. I was using it to load newer versions of POI for excel manipulation, etc. I see now that Adobe has built this into CF, and they have some docs that point to using it like this:

|<||cfset| |THIS.javaSettings = {LoadPaths = [".\javalib\"], loadColdFusionClassPath = true, reloadOnChange = true,watchInterval=30}>

|What they don't cover is how to create objects from these jar files and use them in code. I found an example here:

http://www.isummation.com/blog/day-8-coldfusion-10-and-enhanced-java-integration/

I'm recursively loading POI 3.8 and all it's included jar files using the example above. That doesn't throw any errors or give me any indication that they aren't loaded. I'm doing this in onApplicationStart(). My next challenge is to figure out how to actually reference this new POI version. I assume I would load POI something like this from the URL I included above:

|<||cfobject| |type=||"java"| |class=||"poi"| |name=||"myObj"||>

|
My question is - how do I reference "my" version of POI, rather than the build in Adobe one which is a bit older than I need?

-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform <http://www.acfug.org/?fa=login.edituserform>

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink <http://www.fusionlink.com/>
-------------------------------------------------------------


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink <http://www.fusionlink.com>
-------------------------------------------------------------




-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to