hpzxyj / kaptcha

Automatically exported from code.google.com/p/kaptcha
Other
0 stars 0 forks source link

java.lang.NoSuchMethodError: com.jhlabs.image.RippleFilter.setXAmplitude #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Captcha generation failed with exception
java.lang.NoSuchMethodError: com.jhlabs.image.RippleFilter.setXAmplitude(F)V
    at com.google.code.kaptcha.impl.WaterRipple.getDistortedImage(WaterRipple.java:34)
    at com.google.code.kaptcha.impl.DefaultKaptcha.createImage(DefaultKaptcha.java:44)

Using version 2.3.2
Plateform : 
 - Windows 7
 - Tomcat 6
 - JDK 6
 - Spring 2
 - Struts 2

Configuration : 
    <bean id="captchaProducer" class="com.google.code.kaptcha.impl.DefaultKaptcha">
        <property name="config">
            <bean class="com.google.code.kaptcha.util.Config">
                <constructor-arg type="java.util.Properties">
                    <props>
                        <prop key="kaptcha.border">no</prop>
                        <prop key="kaptcha.image.width">170</prop>
                        <prop key="kaptcha.image.height">27</prop>
                        <prop key="kaptcha.textproducer.char.string">0123456789</prop>
                        <prop key="kaptcha.textproducer.char.length">6</prop>
                        <prop key="kaptcha.textproducer.font.size">25</prop>
                        <prop key="kaptcha.textproducer.font.color">64,64,64</prop>
                        <prop key="kaptcha.textproducer.char.space">10</prop>
                        <prop key="kaptcha.background.clear.from">229,229,229</prop>
                        <prop key="kaptcha.background.clear.to">229,229,229</prop>
                        <prop key="kaptch">test</prop>
                        <prop key="kaptch">test</prop>
                        <prop key="kaptch">test</prop>
                    </props>
                </constructor-arg>
            </bean>
        </property>
    </bean>

Code :   public String load() {
 // Set to expire far in the past.
    response.setDateHeader("Expires", 0);
    // Set standard HTTP/1.1 no-cache headers.
    response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
    response.addHeader("Cache-Control", "post-check=0, pre-check=0");
    // Set standard HTTP/1.0 no-cache header.
    response.setHeader("Pragma", "no-cache");

    // return a jpeg
    response.setContentType("image/jpeg");

    // create the text for the image
    String capText = captchaProducer.createText();

    // store the text in the session
    request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);

    // create the image with the text
    BufferedImage bi = captchaProducer.createImage(capText);

    ServletOutputStream out;
    try
    {
      out = response.getOutputStream();
      // write the data out
      ImageIO.write(bi, "jpg", out);
      try
      {
        out.flush();
      }
      finally
      {
        out.close();
      }
    }
    catch (IOException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return null;
  }

Original issue reported on code.google.com by Vincent....@gmail.com on 15 Sep 2011 at 5:24

GoogleCodeExporter commented 8 years ago
You probably already have com.jhlabs .jar in your classpath.

Original comment by latch...@gmail.com on 15 Sep 2011 at 5:44