java - JCaptcha4Struts2 plugin, image not loading -
i'm pretty new struts , i'm developing application uses captcha validatation. after research pre-built captcha plugins, decided go jcaptcha4struts2.
soon ran series of troubles. resolved of them i'm bot able resolve one.
i did given in demo application in application, image not showing properly. infact, black rectangle appearing. these set of libraries i'm using:
- commons-collection-3.1
- commons-io-2.2
- commons-lang3-3.1
- commons-logging-1.1.3
- commons-logging-api-1.1
- freemarker-2.3.19
- ognl-3.0.6
- struts2-core-2.3.16.1
- xwork-core-2.3.16.1
- javax.mail-1.5.1 odbc7
- javassist-3.11.10.ga
- commons-fileupload-1.3.1
- jcaptcha4struts2-2.0.2
- struts2-jquery-plugin-3.7.0
- jcaptcha-1.0
- jcaptcha-api-1.0
- imaging-01012005
- antlr-2.7.2
the development environemt i'm using is: netbeans 8.0, jdk 1.8, java ee 7
kindly or suggest other captcha option struts2 ( considering i'm new struts , project deadline not far).
edit: read struts 2.3.16 has issues imaging, had tried struts 2.0.11 libraries
jsp file
<%@taglib prefix="jcaptcha" uri="http://code.google.com/p/jcaptcha4struts2/taglib/2.0" %> //some html code <s:form name="login" action="login" method="post"> <s:textfield name="username" label="username" size="20" autofocus="true" /> <s:password name="password" label="password" size="20" /> <jcaptcha:image label="enter text" height="30" width="100"/> <s:submit name="submit" label="submit" align="center" /> </s:form>
struts.xml
<struts> <constant name="struts.devmode" value="true" /> <constant name="struts.action.extension" value="," /> <package name="default" extends="jcaptcha4struts2-default"> <action name="login" class="userloginaction" method="execute"> <interceptor-ref name="jcaptchadefaultstack"/> <result name="success">/profile.jsp</result> <result name="input">/</result> <result name="login">index.jsp</result> <result name="error">/</result> </action> </package> </struts>
edit 2: further tried using various permutations se versions of libraries (most of them being latest , i'm getting exceptions. here's stacktrace
2014-04-07 16:15:25,874 debug org.apache.struts2.dispatcher.dispatcher.debug:80 - exception occurred during processing request: null java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:483) @ com.opensymphony.xwork2.defaultactioninvocation.invokeaction(defaultactioninvocation.java:450) @ com.opensymphony.xwork2.defaultactioninvocation.invokeactiononly(defaultactioninvocation.java:289) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:252) @ org.apache.struts2.interceptor.deprecationinterceptor.intercept(deprecationinterceptor.java:41) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.interceptor.debugging.debugginginterceptor.intercept(debugginginterceptor.java:256) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.defaultworkflowinterceptor.dointercept(defaultworkflowinterceptor.java:167) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.validator.validationinterceptor.dointercept(validationinterceptor.java:265) @ org.apache.struts2.interceptor.validation.annotationvalidationinterceptor.dointercept(annotationvalidationinterceptor.java:68) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.conversionerrorinterceptor.intercept(conversionerrorinterceptor.java:138) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:249) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:249) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.staticparametersinterceptor.intercept(staticparametersinterceptor.java:191) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.interceptor.multiselectinterceptor.intercept(multiselectinterceptor.java:73) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.interceptor.checkboxinterceptor.intercept(checkboxinterceptor.java:91) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.interceptor.fileuploadinterceptor.intercept(fileuploadinterceptor.java:252) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.modeldriveninterceptor.intercept(modeldriveninterceptor.java:100) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.scopedmodeldriveninterceptor.intercept(scopedmodeldriveninterceptor.java:141) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.chaininginterceptor.intercept(chaininginterceptor.java:145) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.prepareinterceptor.dointercept(prepareinterceptor.java:171) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.i18ninterceptor.intercept(i18ninterceptor.java:139) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.interceptor.servletconfiginterceptor.intercept(servletconfiginterceptor.java:164) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.aliasinterceptor.intercept(aliasinterceptor.java:193) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ com.opensymphony.xwork2.interceptor.exceptionmappinginterceptor.intercept(exceptionmappinginterceptor.java:189) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) @ org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:54) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:562) @ org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:99) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:136) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:74) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:516) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1015) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:652) @ org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1575) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1533) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:744) caused by: java.lang.nosuchmethoderror: com.jhlabs.image.waterfilter.setamplitude(d)v @ com.octo.captcha.engine.image.gimpy.defaultgimpyengine.buildinitialfactories(defaultgimpyengine.java:59) @ com.octo.captcha.engine.image.listimagecaptchaengine.<init>(listimagecaptchaengine.java:24) @ com.octo.captcha.engine.image.gimpy.defaultgimpyengine.<init>(defaultgimpyengine.java:48) @ com.octo.captcha.service.image.defaultmanageableimagecaptchaservice.<init>(defaultmanageableimagecaptchaservice.java:32) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:408) @ java.lang.class.newinstance(class.java:433) @ com.google.code.jcaptcha4struts2.core.beans.jc4s2config.getdefaultimagecaptchaservice(jc4s2config.java:110) @ com.google.code.jcaptcha4struts2.core.beans.jc4s2config.getimagecaptchaservice(jc4s2config.java:82) @ com.google.code.jcaptcha4struts2.core.actions.jcaptchaimageaction.getimagecaptchaservice(jcaptchaimageaction.java:107) @ com.google.code.jcaptcha4struts2.core.actions.jcaptchaimageaction.execute(jcaptchaimageaction.java:75) ... 73 more
this jcaptcha library old, , going state of code repository, abandoned project. problem library uses specific version of jh labs image filters captcha image distortion, , version not support jdk 1.8, supports 1.6.
but if went recaptcha, should not bother anymore. decided share findings.
Comments
Post a Comment