Skip to main content
Known Participant
June 4, 2012
Question

coldfusion 10 classpath

  • June 4, 2012
  • 2 replies
  • 6352 views

how does coldfusion 10 works with the classpaths?

ex. in cf9 it uses a very old version of jasper reports, when you try to overload it, it didn't work because of classpath problems and dependencies

would it be possible to create my own build of an implementation of jasper reports with it's dependencies which could have other versions of

.jar files which cf10 uses or would it again collide ?

calling my main class would work because the path is unique but when it will internally will use the dependencies from jasper with it's own depedencies

will it only look in the "classpath container" defined or will it collide again?

tx

    This topic has been closed for replies.

    2 replies

    itisdesign_-_AH
    Inspiring
    June 7, 2012

    I did some playing around w/ THIS.javaSettings and just thought I'd mention a couple of things, in case any of it helps..

    @N0cT1v4Gus, CF Admin's "Java and JVM" page writes the contents of the "ColdFusion Class Path" box to the end of the -Dcoldfusion.classPath list in C:\ColdFusion10\cfusion\bin\jvm.config.  You might try making a backup copy of the jvm.config file, and adding your path(s) to be beginning of the -Dcoldfusion.classPath list.  Be careful tho, b/c if you ever click the "Submit Changes" button on the Java and JVM page, then your entries will be automatically moved to the end of the list.  (so you'd need to manually move them again)  There will soon be an ER filed to also allow CF Admin to display the full -Dcoldfusion.classPath string, and I'll try to remember to follow-up here w/ the ticket#.

    @Leigh, just wanted to note that THIS.javaSettings does work nicely in most cases.  But I currently have an open case regarding a situation where it doesn't (even w/ loadColdFusionClassPath=false).  In that same case, jvm.config works perfectly fine.  I also tried Mark's JavaLoader directly, but the issue exists there as well.  Basically, THIS.javaSettings has problems w/ HTMLUnit.  Depending upon what that underlying issue is, it's possible that THIS.javaSettings doesn't yet work for all cases.  Of course N0cT1v4Gus may never have an issue.  Just noting that I did is all.

    Thanks,

    -Aaron

    Inspiring
    June 7, 2012

    @Aaron - Very true. I have found certain libraries (dom4j, etectera) are known to be problematic whenever multiple class loaders are involved in any application. So you are right that THIS.javaSettings may not work in all cases. Coincidentally, I just ran into a problem with the new setting as well. I have a few suspicions, but am still investigating. Out of curiosity, what is the bug number for your HTMLUnit issue (nothing came up in a brief search)? I am just curious if your issue is the same or related as mine.

    Message was edited by: -==cfSearching==-

    Inspiring
    June 7, 2012

    @Aaron - I think I found it.  Is this the HTMLUnit bug? 

             https://bugbase.adobe.com/index.cfm?event=bug&id=3121307

    As an aside, wow .. that library is a good test case. Almost every single one of the dependencies is already built into CF. No wonder there were problems ;-)

    Inspiring
    June 4, 2012

    I believe the basic mechanism is the same. CF's internal jars take precedence. However, ColdFusion 10 adds the ability to load custom jars on a per application basis using an Application.cfc setting. ( It is basically Mark Mandel's awesome JavaLoader bundled as built in feature of CF10 ;-)  So in theory, both versions of jasper reports can co-exist. 

    There does not seem to be much official documentation on the setting for some weird reason. But this entry about closures gives a good description.

    Known Participant
    June 6, 2012

    so they can't, they will collide internally when the new version tries to lookup some own classes

    it will take the first one found on the classpath and collide

    Inspiring
    June 6, 2012

    Not quite.  How are you using jasper reports - with createObject("java")?  If so, did you see the link above about CF10's new custom class loader feature?

          http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-106e125d1353e804331-7ffe.html