This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes unable to validate using struts 1.2.2 version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "unable to validate using struts 1.2.2 version" Watch "unable to validate using struts 1.2.2 version" New topic
Author

unable to validate using struts 1.2.2 version

naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
Hi all,

I am trying to do client side validations using the struts 1.2.2 jar. but i am getting the following exception while running it.

javax.servlet.ServletException: Servlet.init() for servlet action threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:619)

root cause
java.lang.NoSuchMethodError: org.apache.commons.validator.ValidatorResources.<init>([Ljava/io/InputStream;)V
org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:233)
org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:164)

I specified struts 1.2.2 jar and commons-validator.jar in my application lib and also added the plugin tags for validator plugin.

Any help is appreciated in fixing the issue.

Thanks & Regards,

navi
Prakash Mani - Attur
Ranch Hand

Joined: Oct 08, 2009
Posts: 100
have you created or added validator.xml & validator-rules.xml to your application?
naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
yes. i added the files validation.xml and validator-rules.xml files in my resources.

and added the plugin as follows in struts-config.xml.

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What version of commons validator are you using?
naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
version of commons-validator.jar is 1.0.2
naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
I am using springs along with the struts. version of springs i am using is springs2.

and the struts version is struts 1.2.2.

can we use this version of springs along with struts for validations? or will it create any version conflicts.

any help is appreciated in resolving my issue.

Thanks & regards

navi
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
For validation using Struts 1, you just have to extend org.apache.struts.validator.action.ValidatorForm instead of org.apache.struts.action.ActionForm.

Please confirm this... and have a look at Struts Validator Guide
naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
package com.selfservice.form;

import org.apache.struts.validator.ValidatorForm;

public class UserForm extends ValidatorForm {

---
---

}

I used my action form as shown above and in the struts-config.xml i am using the formbean as follows
<form-bean name="regForm" type="com.selfservice.form.UserForm">
</form-bean>

But even then i am getting the same exception. do we need to specify anymore while integrating springs along with these struts+validations.(bacause i am also using springs along with struts)

can anyone help me in fixing this bug.

Thanks & regards,

navi

naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
working fine if there is no validator plugin in my struts-config.xml file.

But facing the above issue when i added the plugin tag as follows in struts-config.xml and changed the corresponding form as DynaValidatorForm in my formbean

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>


Anyone has an idea about this issue.if so help me.

Thanks & regards,
navi
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It still looks like a version conflict to me.
naveen tp
Greenhorn

Joined: Jul 13, 2010
Posts: 7
version conflict in the sense do we need to use any other validator plugins m for springs integration.

can you please specify any ideas in fixing this issue.

Thanks & regards,
navi
 
wood burning stoves
 
subject: unable to validate using struts 1.2.2 version
 
Similar Threads
Error during ActionServlet initialisation
Im getting this Error "Skipping validation rules file from 'validator-rules.xml'."
spring 2, Hibernate 3, struts 2.1.6 application
Help on Java Plugin
Struts2 + JSON : Getting Class Not Found Error