• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to validate using struts 1.2.2 version

 
naveen tp
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you created or added validator.xml & validator-rules.xml to your application?
 
naveen tp
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of commons validator are you using?
 
naveen tp
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
version of commons-validator.jar is 1.0.2
 
naveen tp
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still looks like a version conflict to me.
 
naveen tp
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic