Skip to main content

CFPDF problems with RAILO running on AMAZON EC2

I've been deploying more and more apps to Amazon Elastic Beanstalk and EC2 lately, and ran into this interesting issue.  While using CFPDF to get thumbnail images of PDF files, I got the dreaded "
com.sun.image.codec.jpeg.JPEGDecodeParam.getEncodedColorID" error.  After doing some quick research, I was displeased to see that apparently CFPDF still relies on the old 2D java libs for image manipulation. 
This in itself wasn't of huge immediate concern to me, though because the code runs fine on windows server, so why am I getting errors, since I'm running the same version of the SDK: 1.6, which should still have those libs.  I checked the environment variables and discovered that EC2 instances run OPENJDK instead of the Sun (Oracle) JDK.
This turned out to the THE core issue, as openjdk does not have the old 2D libs included for many (mostly good) reasons.  My guess is that there are probably other little issues that popup up because of the difference in JDK. So the solution is to dump the openjdk and put in sun(oracle) JDK instead.
Luckily I came across this post which explains how to install the new JDK and set it as default for EC2. 
When you remove OpenJDK using rpm -e --nodeps, you end up removing some symbolic links that are not created upon installing Sun JDK bin.

Here are the commands for Tomcat, 64bit (similar to truthtrap's)

cd ~
wget -O jdk-6u25-linux-x64-rpm.bin
sudo chmod +x jdk-6u25-linux-i586-rpm.bin
sudo ./jdk-6u25-linux-i586-rpm.bin
sudo alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
sudo update-alternatives --config java
sudo ln -s /usr/java/default/jre /usr/lib/jvm/jre
sudo ln -s /usr/share/java /usr/lib/jvm-exports/jre

(Optional) While you are at it, install PSI-Probe in the Dev environments to monitor your JVMs.

Just copy probe.war to /usr/share/tomcat6/webapps, start Tomcat using: /etc/init.d/tomcat6 start 

of course, you will probably want to get the newer build of the JDK which was b30 at the time of writing this blog entry.  Also note whether you want to the 32-bit or 64-bit version.

Once I followed these directions, everything ran great and stable.

Popular posts from this blog

Installing python 3.4.x on OSX El Capitan

I love "brew" package manager, but sometimes being too progressive breaks things.  I have several python apps that I maintain that get deployed to AWS using Elastic Beanstalk.  AWS eb can deploy with python 2.7 or 3.4.  Any recent 'brew install python3" will get 3.5.1. #annoying

Making Macbook Air with 128GB SSD usable with Bootcamp

I recently got a new Macbook Air 11" (the 2012 version) and loaded it with goodies like 8GB ram and 2GHz Core i7.  What I DIDN'T upgrade was the internal SSD.  My config came with 128GB SSD and I refused to pay $300+ to upgrade it to 256GB.  Yeah I know, some call me cheap, but SSds cost $75-$150 for 240GB, so adding another 128GB for $300 seemed way too steep for me.  I figured "ok, I'm going to make 128G work!"

Here is the story of how that went...

Getting Started with OpenVAS on CentOS - an open source vulnerability scanner

The Open Vulnerability Assessment System (OpenVAS) is a framework of several services and tools offering a comprehensive and powerful vulnerability scanning and vulnerability management solution. (Taken from the OpenVAS website, which is at )

This blog entry will introduce OpenVAS version 3.1, walk through installation on CentOS and is intended as a "getting started" guide. I'll also do a guide for installing on Ubuntu later.