I have been fighting an issue with ImageGetBlob(). I am trying to run some very simple code:
<cfimage action="read" name="img" source="#expandPath("zoid.jpg")#" />
<cfset moo = ImageGetBlob(img) >
When I run this on my dev macine, which is running Mac OS X with ColdFusion 8 installed as 'multi-server', I get a JRun 500 error, the first few lines of which are:
ROOT CAUSE:
java.lang.NoClassDefFoundError
at coldfusion.image.Image.getImageBytes(Image.java:519)
at coldfusion.runtime.CFPage.ImageGetBLOB(CFPage.java:5642)
There have been 2 other people who are running ColdFusion under similar operating system/server install configurations that get the same error. I have also asked someone running ColdFusion 8 as a 'stand alone' on a Mac and the code works as expected. The code also works as expected on Windows XP running ColdFusion 8 as a 'multi-server install.
Has anyone else seen this problem? If you are running ColdFusion on a Mac, either as a 'stand alone' or 'multi-server', would you mind giving the code above a try (obviously changing the image path) and reply back to say if you were successful or not and what your set up is?
Thanx in advance!




11 comments
details from my CF admin info page...
OS: OS X 10.5.4
CF: 9,0,1,195765
edition: developer
Java version: 1.5.0_13
Java VM version: 1.5.0_13-119
from the error (can't paste as this is another machine and it's too long to type out :) ) it appears that the com.sun.media.jai.util package is sealed and as such may be conflicting with another instance of the same class somewhere on the classpath.
http://forums.sun.com/thread.jspa?threadID=5293731...
perhaps an update beyond java 6 updater 6 will rectify it.
'I replicated the issue on my system, and it appears that problem is that Apple ships the JAI with their own native library which is version 1.1.2 which exists in /System/Library/Java/Extensions.
Adobe ships JAI 1.1.3 which is inside the CF's library path.
Unfortunately this creates the conflict and the exception you saw.
To fix it add the following to you to java.args in the jvm.config for JRun:
-Djava.ext.dirs=/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Home/lib/ext'
2 things:
1. Make sure you backup jvm.config before making any changes.
2. Restart CF after making thsi change.
Elliot: You da man too
Thanks for the fix
That said, I'd like to know the rationale behind Elliot's fix...
This fixed all of my JAI conflicts.
My iMac and I both thank you.
I had solved it by following Elliot's advice, but it had a side-effect of crapping out SSL LDAP. By doing this, I think you're removing critical libraries for encryption.
Jared asked what the rationale is - if you compare the "Java Ext Dirs" in CF Administrator with Elliot's fix in place, and with it removed, you'll see a couple of directories missing with Elliot's fix.
One of these dirs, /System/Library/Java/Extensions, contains JAI jars (jai_core and jai_codec).
I've found that if you remove those two jars from this directory, this image (well, my image issue was slightly different, but very likely stemmed from the same root cause) problem will be resolved, without crapping out SSL.
I do NOT know what effect this might have on any other java programs that may or may not expect JAI to be in that directory.
I'm trying to think of another way to do this that would not have an effect on the OS as a whole.
Messing with the /System/Library/Java/Extensions directory, or really anything under /System is a bad idea. That's the reason I chose a fix that only effected CF.
Removing those two libraries will likely break pretty much every Java application that uses ImageIO that assumed the existence of the provided libraries from Apple. I have a feeling that includes a bunch of browser Applets.
Instead copy what you need from /System/Library/Java/Extensions into the CF folder and then use the fix I was talking about. Or go Jared's route and just nuke the CF jars, but that will break certain CF image features unfortunately. I can't remember which ones, but that was the reason I didn't do it that way.
Looking in that folder I can't imagine what relates to SSL LDAP though. It's all AppleScript and graphics related.