Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

captcha images

Status
Not open for further replies.

puntito

Programmer
Mar 22, 2006
18
0
0
Please, i'm in a hurry.
I need to implement the captcha tool 4 user registration.
I have been read a lot, and almost done it but i have a problem.
ok, first i'm using struts and spring.
my webApplicationContext.xml look like this:

<code>

<bean id="imageCaptchaService" class="com.octo.captcha.service.ManageableCaptchaService">
<constructor-arg index="0">
<ref bean="imageEngine"/>
</constructor-arg>

<constructor-arg index="1">
<value>180</value>
</constructor-arg>

<constructor-arg index="2">
<value>180000</value>
</constructor-arg>

</bean>

<bean id="imageEngine" class="com.octo.captcha.engine.CaptchaEngine" >
<constructor-arg index="0">
<ref bean="CaptchaFactory"/>
</constructor-arg>
</bean>

<bean id="CaptchaFactory" class="com.octo.captcha.image.gimpy.GimpyFactory" >
<constructor-arg><ref bean="wordgen"/></constructor-arg>
<constructor-arg><ref bean="wordtoimage"/></constructor-arg>
</bean>

</code>

but the error is:

Error creating bean with name 'imageEngine' defined in ServletContext resource [/WEB-INF/conf/spring/webApplicationContext.xml]: Could not resolve matching constructor

[/color red]

i cannot find what or how to send the correct parameters to the constructor of com.octo.captcha.engine.CaptchaEngine

the package looks like this:

<code>
package com.octo.captcha.engine;

import com.octo.captcha.Captcha;
import java.util.Locale;

public interface CaptchaEngine
{

public abstract Captcha getNextCaptcha();

public abstract Captcha getNextCaptcha(Locale locale);
}

</code>

and

<code>
package com.octo.captcha;

import java.util.Locale;

// Referenced classes of package com.octo.captcha:
// Captcha

public interface CaptchaFactory
{

public abstract Captcha getCatcha();

public abstract Captcha getCatcha(Locale locale);
}
</code>


please, somebody help me!!!!
I'm getting crazy with this.
Is an emergency !!!

Thank you !!!
 
How do you expect Spring to create a bean from CaptchaEngine and CaptchaFactory when they are interfaces? Interfaces cannot be instantiated, only implemented by classes.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top