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 http://download.oracle.com/otn-pub/java/jdk/6u25-b06/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...

Election day plus 1: Social Media Nightmare

It is election day plus 1, and a very emotional day with no way to win for many.

Social media was a force to be reckoned with this election year.  No matter what position you take, the world is ready to pounce on you and tell you why YOU are evil, intolerant or a deplorable -- and the reason for all their woes.  This isn't a new problem, though...  All of the liberal vs conservative issues are causing rifts between otherwise civil people, and it seems to be the worst on Facebook and twitter.

If I say I am for Hillary:
i am part of the "corrupt system."

If I say I am against Hillary:
I am stupid and uneducated

If I say I am for Trump:
I am against women,
I am religiously intolerant,
I am a bigot

If I say I am against Trump:
I am against the 2nd amendment,
I don't have any idea how government works,
I am part of the problem with American society,
I am against the police

Stay with me now, this isn't meant to make people angry, but it is mean to shine some light on a social …