You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Muller <mm...@theworld.com> on 2003/07/07 18:25:39 UTC
ClassCastException using the DynaValidatorForm
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
Re: ClassCastException using the DynaValidatorForm
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Bummer. It isn't so simple, judging from your stack trace. Looks like a
config error, because struts is barfing when it tries to create your
action form.
Michael Muller wrote:
>
> All my fields are strings.
>
> Here's some of my struts-config.xml:
>
> <form-bean name="foo" type="org.apache.struts.validator.DynaValidatorForm">
> <form-property name="pbTitle" type="java.lang.String" />
> <form-property name="pbAge" type="java.lang.String" />
> <form-property name="pbFirstName" type="java.lang.String" />
> <form-property name="pbLastName" type="java.lang.String" />
> ...
> </form-bean>
>
>
> 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
Re: ClassCastException using the DynaValidatorForm
Posted by Michael Muller <mm...@theworld.com>.
All my fields are strings.
Here's some of my struts-config.xml:
<form-bean name="foo" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="pbTitle" type="java.lang.String" />
<form-property name="pbAge" type="java.lang.String" />
<form-property name="pbFirstName" type="java.lang.String" />
<form-property name="pbLastName" type="java.lang.String" />
...
</form-bean>
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
Re: ClassCastException using the DynaValidatorForm
Posted by Joe Germuska <Jo...@Germuska.com>.
At 10:09 -0600 7/8/03, 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.
The name in action mapping needs to relate back to a name in the
form-beans configuration. So you should be able to change the name,
as long as you change it in both places. If you use the "name"
property in your <html:form> JSP tags, you have to change it there
also, although during the 1.1 development cycle this was changed so
that the html:form tag would look up the form bean from the mapping
found with the html:form action attribute.
You shouldn't be stuck with a "foo" form, but you may need to make
changes in more than one place.
Joe
>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
--
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"If nature worked that way, the universe would crash all the time."
--Jaron Lanier
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: ClassCastException using the DynaValidatorForm
Posted by Michael Muller <mm...@theworld.com>.
originally, i had a custom form bean with the name "myForm" and an
action with the same name.
i set up validation, and all was well. my form has oodles of fields,
however, so i figured i could save myself a load of development and
maintenance by using the dyna-form beans.
so, i created another form bean (a DynaValidatorForm) in my
struts-config. i named it "myForm", and re-named the old "myForm" to be
"foo" so that i wouldn't have two forms with the same name.
this resulted in the ClassCastException i described earlier, despite
reloading the webapp and even restarting tomcat.
so i switched and renamed the dyna-bean "foo" and the custom form bean
"myForm". things started working again.
THEN, i changed the name of the form bean used by the action to "foo"
(which is now the name of the dynamic from bean). to my surprise, that
works! and that's where i am now. functional, but confused.
i can hear the PHP guys snickering. :(
-- mike
Adam Hardy wrote:
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: ClassCastException using the DynaValidatorForm
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
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
Re: ClassCastException using the DynaValidatorForm
Posted by Michael Muller <mm...@theworld.com>.
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
Re: ClassCastException using the DynaValidatorForm
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
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
Re: ClassCastException using the DynaValidatorForm
Posted by Michael Muller <mm...@theworld.com>.
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
Re: ClassCastException using the DynaValidatorForm
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
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