SimpleCaptcha for Servers
Currently there is a bug in SimpleCaptcha library that prevents it running in non-graphics environments. It will throw a java.awt.HeadlessException. Although the code does not rely on various graphics classes, they were left causing this problem.
I fixed the code and recompiled it. You can download the fixed JAR file here. Do not forget to set the system property java.awt.headless to true, e.g. by specifying Djava.awt.headless=true at command line.
June 18th, 2008 at 10:00 am
Hey thx man!
That saved me really a lot of time!
July 11th, 2008 at 6:59 pm
Me too. It’s great when things work out of the box, and when they don’t, that somebody else has fixed it for me.
July 16th, 2008 at 9:57 am
HI ,
I am also using the same simple captcha, but it is getting the previous value rather than current value when i fetch it form session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY)) ;
should i change any thing
Thanks,
Suneel
July 16th, 2008 at 12:42 pm
Perhaps you have got some session problems? I usually perform:
String v = (String)request.getSession().getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
Another problem might be an intraceable session from your request? Check your webapp container whether it enables session tracking.
July 18th, 2008 at 2:16 pm
Many thanks.
September 17th, 2008 at 4:45 pm
Thank you! It does work. I had the same problem and it got fixed with the new jar file. What have you actually changed?
September 17th, 2008 at 6:00 pm
I removed all unnecessary referrals / attributes from the SimpleCaptcha classes that were referring to graphical display classes.
October 22nd, 2008 at 2:35 pm
Hi Ralph,
You fixed a bug in SimpleCaptcha, so it can be used with headless mode. I am using Kapcha (fork of SimpleCaptcha) on Websphere 5.1, JDK 1.4.2 with -Djava.awt.headless=true. The parameters cannot be changed, because of dependencies with other applications. And I get the java.awt.HeadlessException. What did you change to get it working?
Thank you for your time!
Bert
October 22nd, 2008 at 2:49 pm
Hi Bert, see my previous post.