struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: ClassCastException using the DynaValidatorForm
Date Tue, 08 Jul 2003 22:05:21 GMT
Sorry, no comprendo. What are you changing in the action mapping? Do 
your mappings & form names & validator xml correspond?

I appreciate your concern about your PHP colleagues :)

Michael Muller wrote:
> 
> i don't know what's in 'instance', i'm just guessing it's not a DynaBean 
> because of the exception i'm getting.
> 
> i have discovered that if, instead of renaming the forms, i change the 
> name of the form in the action mapping, validation works.
> 
> so now i have a form named "foo".  :(
> 
> not very elegant.  my php-centric coworkers will mock me.  i'll be the 
> laughingstock of the company.
> 
>   -- mike
> 
> Adam Hardy wrote:
> 
>> I missed your second post. My mailer didn't thread it. So what is 
>> struts putting in 'instance' if it's not a dynabean?
>>
>> I don't suppose it would be so simple as the wrong form specified in 
>> the action mapping?
>>
>> Michael Muller wrote:
>>
>>>
>>> Here's the struts source that's throwing the exception:
>>>
>>> // Can we recycle the existing form bean instance (if there is one)?
>>> if (instance != null) {
>>>     if (config.getDynamic()) {
>>>         String className = ((DynaBean) 
>>> instance).getDynaClass().getName();
>>>         if (className.equals(config.getName())) {
>>>
>>> Apparently, "instance" is not a DynaBean.  It would appear that 
>>> something other than a DynaBean is being stored where struts expects 
>>> to find a DynaBean.
>>>
>>> Does this help anyone figure out what I'm doing wrong?
>>>
>>>   -- Mike
>>>
>>>
>>> Adam Hardy wrote:
>>>
>>>> I got ClassCast exceptions, but not necessarily this one, because I 
>>>> was using field class types other than Strings in my DynaActionForm. 
>>>> DynaValidator will only validate strings, btw.
>>>>
>>>> Adam
>>>>
>>>> Michael Muller wrote:
>>>>
>>>>>
>>>>> I've got the validation framework working for me using my own form 
>>>>> bean which is derived from ValidatorForm.  I changed the form bean 
>>>>> to be a DynaValidatorForm, and now I get a ClassCastException, the 
>>>>> guts of which is appended below.
>>>>>
>>>>> What gives?  Am I using the wrong validator form class?  Did I 
>>>>> neglect to make some other configuration change?
>>>>>
>>>>> I'm using Tomcat 4.1, Struts 1.1 final, and jdk 1.4.1.
>>>>>
>>>>>   -- Mike
>>>>>
>>>>>
>>>>>
>>>>> java.lang.ClassCastException
>>>>>     at 
>>>>> org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:783)

>>>>>
>>>>>     at 
>>>>> org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:364)

>>>>>
>>>>>     at 
>>>>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:253)

>>>>>
>>>>>     at 
>>>>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

>>>>>
>>>>>     at 
>>>>> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>>>>     at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>>>>     at 
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>>>>     at 
>>>>> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>>>>     at 
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

>>>>>
>>>>>     at 
>>>>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>>>>     at 
>>>>> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

>>>>>
>>>>>     at 
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)

>>>>>
>>>>>     at 
>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)

>>>>>
>>>>>     at 
>>>>> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)

>>>>>
>>>>>     at 
>>>>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)

>>>>>
>>>>>     at java.lang.Thread.run(Thread.java:536)
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


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


Mime
View raw message