Skip to main content
November 30, 2008
Question

Why is Jasper embedded in CF8

  • November 30, 2008
  • 2 replies
  • 516 views
I'm trying to invoke the Jasper Report engine directly from ColdFusion. I've ran into a bit of a snag because CF has compiled Jasper into it's main JAR and so there is no way to override it. The below code can be ran in ColdFusion 8 and you'll see the path and file CFUSION.JAR

<cfobject type="java" class="net.sf.jasperreports.engine.JasperRunManager" action="create" name="jrrm" >
<cfobject type="java" class="net.sf.jasperreports.engine.JasperCompileManager" action="create" name="jrcm" >

<cfoutput>#jrrm.getClass().getProtectionDomain().getCodeSource().getLocation().toString()#</cfoutput>

Since .JAR files are just .ZIP files I extracted it and noticed a NET.SF.JASPERREPORTS path directly in the CFUSION jar. It's all compiled code so I have no idea what version of Jasper it is.

I'm tempted to just plop the new version in the CFUSION jar and rebuilt it. What I can't determine is what within CF is even using Jasper...does anyone on here having any ideas...or an idea on how to find out? And rebuilding this JAR seems like a bit too hacky.
    This topic has been closed for replies.

    2 replies

    Inspiring
    December 1, 2008
    twillerror wrote:
    > To update this posting I've found if I put the Jasper JAR file in the
    > c:\coldFusion8\lib directory it will load over CFUSION, but only if I name it
    > someting like AJasper.jar.... The key is to have it list before Cfusion in
    > alpha order. I'm guessing the JVM loads up JAR files this way...:)

    are you sure you got the right version? usually what's 'native' to cf will get
    on the classpath ahead of other stuff & i'm not sure just renaming the jar is
    enough. jasper reports are what cf uses for the cfreport bits (along w/iText for
    pdf support).

    can't you just use the baked in jasper lib (we often use the 'old' iText lib
    that comes w/cf)? if not, have a look at mark mandel's javaLoader. it can
    arbitrarily load java libs, works a treat (we use it when we need the very
    latest iText lib).




    November 30, 2008
    To update this posting I've found if I put the Jasper JAR file in the c:\coldFusion8\lib directory it will load over CFUSION, but only if I name it someting like AJasper.jar.... The key is to have it list before Cfusion in alpha order. I'm guessing the JVM loads up JAR files this way...:)