commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: Validator Exception
Date Tue, 11 Nov 2003 16:18:58 GMT

--- Srinivas Gunturu <sxg1127@bjc.org> wrote:
> Hi All,
> 
> I am using commons validator and struts.  The validation works fine
> within struts.  However, I have a business need to re-use validation
> outside struts.  I am trying to invoke validator with following code. 
> However, I am getting an exception.  Any idea what might be the reason?
> 

The stack trace indicates you're running this from Struts but you say that
it works fine from Struts?  InvocationTargetException is thrown when a
dynamically called method throws an exception.  Does your validation
method throw an exception?

David

> Thanks in advance.
> 
> Srinivas
> 
> Here is my code
> ------------------------------------------------------------
> ValidatorResources resources = new ValidatorResources();
> 			
> InputStream rules =
>
getServlet().getServletContext().getResourceAsStream("/WEB-INF/validator-rules.xml");
> 			
> ValidatorResourcesInitializer.initialize(resources, rules);
> 			
> InputStream forms =
>
getServlet().getServletContext().getResourceAsStream("/WEB-INF/validation.xml");
> 			
> ValidatorResourcesInitializer.initialize(resources, forms);
> 			
> InputStream formsTwo =
>
getServlet().getServletContext().getResourceAsStream("/WEB-INF/validation-eventSelection.xml");
> 			
> ValidatorResourcesInitializer.initialize(resources, formsTwo);
> 			
> Validator validator = new Validator(resources, "eventDetailForm");
> EventDetailForm form = new EventDetailForm();
> form.setEventDetailBean(event.getSafetyEventDetailBean());
> form.setAction(Constants.EDIT);
> form.setFormName(Navigator.MED_EVENT_DETAIL);
> validator.addResource(Validator.BEAN_KEY, form);
> ValidatorResults results = validator.validate();
> 
> ---------------------------END OF CODE-------------------------------
> 
> Here is the exception 
> 
> ---------------------------------------------
> Nov 11, 2003 9:59:11 AM org.apache.commons.validator.Validator
> validateFieldForR
> ule
> SEVERE: reflection: null
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.commons.validator.Validator.validateFieldForRule(Validator
> .java:454)
>         at
> org.apache.commons.validator.Validator.validateField(Validator.java:5
> 44)
>         at
> org.apache.commons.validator.Validator.validate(Validator.java:582)
>         at org.bjc.ses.action.ShowEventAction.execute(Unknown Source)
>         at
> org.apache.struts.action.RequestProcessor.processActionPerform(Reques
> tProcessor.java:484)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:274)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
> 2)
>         at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:260)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> t.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:191)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> t.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
> 2396)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:180)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> t.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
> rValve.java:170)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
> t.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:172)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message