JCaptcha - refresh image
843841Mar 7 2006 — edited Mar 8 2006Hi,
I'm trying to build a registration page with captcha image, and enables user to change the captcha image by clicking a link.
I tried the open-source JCaptcha project. (5 minutes application integration tutorial http://luminal.gotdns.com/confluence/display/general/5+minutes+application+integration+tutorial)
It worked fine when first load the page. But when I click reload, exception happends:
If I try to reload after ,say 5 mins, the page works again.
java.lang.ClassCastException: java.lang.String
net.sf.ehcache.Element.equals(Element.java:165)
java.util.HashMap.eq(Unknown Source)
java.util.HashMap.removeEntryForKey(Unknown Source)
java.util.HashMap.remove(Unknown Source)
net.sf.ehcache.store.MemoryStore.remove(MemoryStore.java:219)
net.sf.ehcache.Cache.remove(Cache.java:716)
net.sf.ehcache.Cache.remove(Cache.java:683)
com.octo.captcha.service.EhcacheManageableCaptchaService.generateAndStoreCaptcha(EhcacheManageableCaptchaService.java:826)
com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:538)
com.octo.captcha.service.image.EhcacheManageableImageCaptchaService.getImageChallengeForID(EhcacheManageableImageCaptchaService.java:505)
ImageCaptchaServlet.doGet(ImageCaptchaServlet.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
I read the example code, found that it takes session id as key to recognize the request. So, it seems to be: when reload attempts, the same session id is sent to the service to acquire an image, but the captcha service doesn't support one session id with different images.
Can anybody guide me to make it work? any other resource can help to solve the problem?