Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Cache problem

Shai If
2010-07-27
2013-05-08
  • Shai If
    Shai If
    2010-07-27

    Hi Everybody,
    I got the captcha module running for jGuard. It feels great; however, once the image is displayed, if i refresh the page, i get the following exception:
    java.lang.ClassCastException: java.lang.String cannot be cast to net.sf.ehcache.Element
    at net.sf.ehcache.Element.equals(Element.java:236)
    at java.util.HashMap.removeEntryForKey(Unknown Source)
    at java.util.HashMap.remove(Unknown Source)
    at net.sf.ehcache.store.MemoryStore.remove(MemoryStore.java:173)
    at net.sf.ehcache.Cache.remove(Cache.java:999)
    at net.sf.ehcache.Cache.remove(Cache.java:938)
    at net.sf.ehcache.Cache.remove(Cache.java:898)
    at net.sf.ehcache.Cache.remove(Cache.java:880)
    at com.octo.captcha.service.EhcacheManageableCaptchaService.generateAndStoreCaptcha(EhcacheManageableCaptchaService.java:826)
    at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:538)
    at net.sf.jguard.jee.authentication.http.CaptchaChallengeBuilder.buildCaptchaChallenge(CaptchaChallengeBuilder.java:121)
    at net.sf.jguard.jee.authentication.http.CaptchaChallengeBuilder.buildCaptchaChallenge(CaptchaChallengeBuilder.java:84)
    at infy.jGuard.CaptchaAction.doGet(CaptchaAction.java:34)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Unknown Source)

    So, this is the thing: if i run it the first time, all is well: the captcha image is displayed and the whole thing works. The problem arises if i try to refresh the page. Can sb pls help me with the above. If the solution is to turn off caching, can sb explain how can we do that.

    Shai

     
  • Hi Shai,
    Unfortunately I am not experienced in this feature. Which version of jGuard are you using? I will take a look at the code and try to find something…

    's
    Vinícius Pitta Lima de Araújo
    http://www.viniciusaraujo.net

     
  • Shai If
    Shai If
    2010-07-27

    Hi Vinicius,
    I am using 1.04 version.

    Thanks for your help! You have been of great help. Btw I have another small query which i am posting soon for your reference

    Shai

     
  • Seems to be something wrong with captcha configuration… Are you able to run the struts example with captcha enabled and without run in this problem?

    's
    Vinícius Pitta lima de Araújo
    http://www.viniciusaraujo.net