Overview
In a load balanced environment the default singleton implementation doesnt work out of the box.
There is two solution in order to achieve captcha validation throught load-balancing
- Use a "distributed singleton" implemented with an distributed cache CaptchaStore (like JBossCache)
- Use sticky session
The JBossCacheStore allows JCaptcha to be used in a clustered environment, generated captchas are stored in a distributed Cache. A user can now retrieve a captcha from a node and validate it on another node.
This tutorial shows how to set up the JCaptcha extension and configure JBossCache 2
Add project dependencies
jcaptcha-extension-jbosscache-store v1.0 supports JBossCache 2.x
jcaptcha-extension-jbosscache-store v2.x supports JBossCache 3.x
Maven2 users
Add the following dependency to your project POM
Code Block |
---|
<dependency> <groupId>com.octo.captcha</groupId> <artifactId>jcaptcha-extension-jbosscache-store</artifactId> <version>1.0-SNAPSHOT<<version> </version> </dependency> |
Without Maven2
...
- The JCaptcha extension
- jcaptcha-extension-jbosscache-store-1.0-SNAPSHOT.jar
- JBossCache dependencies
- The JCaptcha extension POM contains names, versions and repository URL to download them.
...
Deployment scheme
Please refers to the JGroups reference documentation for detailed explanations.
http://www.jgroups.org/javagroupsnew/docs/tutorial/html_single/index.html