commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Srinivas Gunturu" <sxg1...@bjc.org>
Subject Re: Validator Exception
Date Tue, 11 Nov 2003 16:27:19 GMT
Thanks for the response.  I was trying to avoid explain what I was doing.  I will try to be
short.

We are migrating a legacy system to an intranet website in a phased out manner.  While some
users use the legacy system to enter data, some will be using online system.  Legacy system
is very lenient as far as data validation goes.  We have a nightly batch process that transfers
data from legacy system to the new intranet system.  

The data is entered using a wizard flow and consists of 6-10 screens.  At the end user has
a summary/review screen before data is persisted.  We have reviewers reviewing data coming
from legacy system and fix it.  When a reviewer opens legacy data on the intranet, we take
them directly to summary page.  On summary page, we would like to validate all legacy data
and display visual indicators for each form that fails validation.

Instead of re-writig the validation, I am trying to invoke validator with in my action class
by passing one form at a time to validate.  I am only at the begining and have 15+forms to
go.

Now to answer your question, No, my validate method does not throw an exception.

I can include my validate code if needed.

>>> grahamdavid1980@yahoo.com 11/11/03 10:18AM >>>

--- 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 




---------------------------------------------------------------------
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