• 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

capacha

 
Ranch Hand
Posts: 118
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,
I am trying to implement capatcha in jsp application , using jcapatcha : i have the following

web.xml



index.jsp




CaptchaServiceSingleton.java




ImageCaptchaServlet.java




when calling servlet jcapacha , i am getting null pointer





any suggestion how to implement it .

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So which object is null? And in which line of code does the exception happen?
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thansk for your reply,


exeception happened in this line :
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:So which object is null?


challenge or jpegEncoder? Once you know which one it is, check the javadocs of all methods you're calling to create these objects to learn under which circumstances they might return null.
 
Ranch Hand
Posts: 88
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am just gussing but it looks like challenge is null which is returned by the method you created.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks All for the replies

After long search and checking , I have found the exact Problem .

By the way i was using openjdk I was getting the the null pointer exception (jpegEncoder was null) but i have tested the same code using sun jkd and it works fine .

the got the tip from :

OpenJDK does not have a native JPEG encoder, try using Sun's JDK, or using a library (such as JAI

AFAIK, regarding the "pinkish tint", Java saves the JPEG as ARGB (still with transparency information). Most viewers, when opening, assume the four channels must correspond to a CMYK (not ARGB) as thus the red tint.

If you import the image back to Java, the transparency is still there, though.


from the link


my question now is How to implement that using jai so that i could run it using openjdk


 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're just trying to read or write a JPEG image, use the ImageIO class - it is available on all JDKs. That's much preferable to using JAI. If you're doing something else, tell us in more detail what that is.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf Dittmer ,

I am creating image for the capacha purpose , by the way I have already post the related code in my first post.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestion
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic