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.

9 replies on “SimpleCaptcha for Servers”

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


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.

I removed all unnecessary referrals / attributes from the SimpleCaptcha classes that were referring to graphical display classes. 😉

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!


Leave a Reply

Your email address will not be published. Required fields are marked *