• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JCaptcha image not displays on heavy load

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

We are facing issue in our live site related to display captcha image in site. It works fine in other environment suddenly this issue started in production now. This issues starts when production server has heavy loads and below exceptrion stops displaying captcha image. Restarting of server starts displaying captcha image.

We are using JCaptcha 2.0.jar and

We created servlet which generate image by using jcaptcha library. We have our own code generator which randomly generates character and number combination code. By using captcha library we convert into image and displays to web page.

TextPaster randomPaster = new GlyphsPaster(Integer.valueOf(7), Integer.valueOf(7), new RandomListColorGenerator(new Color[] {
new Color(23, 170, 27), new Color(220, 34, 11), new Color(23, 67, 172)
}), new GlyphsVisitors[] {
new TranslateGlyphsVerticalRandomVisitor(1.0D), new OverlapGlyphsUsingShapeVisitor(3D), new TranslateAllToRandomPointVisitor()
});
BackgroundGenerator back = new UniColorBackgroundGenerator(Integer.valueOf(200), Integer.valueOf(70), Color.white);
FontGenerator shearedFont = new RandomFontGenerator(Integer.valueOf(50), Integer.valueOf(50), new Font[] {
new Font("nyala", 1, 50), new Font("Bell MT", 0, 50), new Font("Credit valley", 1, 50)
}, false);
PinchFilter pinch = new PinchFilter();
pinch.setAmount(-0.5F);
pinch.setRadius(70F);
pinch.setAngle(0.1963495F);
pinch.setCentreX(0.5F);
pinch.setCentreY(-0.01F);
pinch.setEdgeAction(1);
PinchFilter pinch2 = new PinchFilter();
pinch2.setAmount(-0.6F);
pinch2.setRadius(70F);
pinch2.setAngle(0.1963495F);
pinch2.setCentreX(0.3F);
pinch2.setCentreY(1.01F);
pinch2.setEdgeAction(1);
PinchFilter pinch3 = new PinchFilter();
pinch3.setAmount(-0.6F);
pinch3.setRadius(70F);
pinch3.setAngle(0.1963495F);
pinch3.setCentreX(0.8F);
pinch3.setCentreY(-0.01F);
pinch3.setEdgeAction(1);
java.util.List textDef = new ArrayList();
textDef.add(new ImageDeformationByBufferedImageOp(pinch));
textDef.add(new ImageDeformationByBufferedImageOp(pinch2));
textDef.add(new ImageDeformationByBufferedImageOp(pinch3));

WordToImage word2image = new DeformedComposedWordToImage(false, shearedFont, back, randomPaster,

new ArrayList(), new ArrayList(), textDef);
//Error throws in getimage() call.

BufferedImage bi = word2image.getImage(codeVerifier);


Error Trace:
java.lang.NullPointerException
at com.jhlabs.image.TransformFilter.getPixel(TransformFilter.java:139)
at com.jhlabs.image.TransformFilter.filter(TransformFilter.java:116)
at com.jhlabs.image.PinchFilter.filter(PinchFilter.java:105)
at com.octo.captcha.component.image.deformation.ImageDeformationByBufferedImageOp.deformImage(ImageDeformationByBufferedImageOp.java:30)
at com.octo.captcha.component.image.wordtoimage.DeformedComposedWordToImage.getImage(DeformedComposedWordToImage.java:142)
at site.gtech.portal.ui.common.PortalImageCaptchaServlet.doGet(PortalImageCaptchaServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

 
reply
    Bookmark Topic Watch Topic
  • New Topic