Re: ClassCastException using the DynaValidatorForm
Don't you just love caching? The number of errors I have made like that which drove me insane until whatever it was - the browser, the server, the memory - stopped caching. Torture. Michael Muller wrote: That would explain it. The struts-config got re-loaded telling it that myForm was a dyna bean, but the re-serialized bean in the session was still one of my custom beans. Thank you! I had no idea that Tomcat serialized the session data when it shut down. -- Mike Wendy Smoak wrote: this resulted in the ClassCastException i described earlier, despite reloading the webapp and even restarting tomcat. Did you also close the browser window you were using to test? IIRC, Tomcat serializes session data when you shut it down. Just a guess, but I think you had a session sitting around with the old form bean, and since the name was the same, it got used. If you had changed the name from the beginning (myForm2) you likely never would have seen this. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException using the DynaValidatorForm
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
Re: ClassCastException using the DynaValidatorForm
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail:
Re: ClassCastException using the DynaValidatorForm
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
Re: ClassCastException using the DynaValidatorForm
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
Re: ClassCastException using the DynaValidatorForm
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
Re: ClassCastException using the DynaValidatorForm
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
RE: ClassCastException using the DynaValidatorForm
this resulted in the ClassCastException i described earlier, despite reloading the webapp and even restarting tomcat. Did you also close the browser window you were using to test? IIRC, Tomcat serializes session data when you shut it down. Just a guess, but I think you had a session sitting around with the old form bean, and since the name was the same, it got used. If you had changed the name from the beginning (myForm2) you likely never would have seen this. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
Re: ClassCastException using the DynaValidatorForm
That would explain it. The struts-config got re-loaded telling it that myForm was a dyna bean, but the re-serialized bean in the session was still one of my custom beans. Thank you! I had no idea that Tomcat serialized the session data when it shut down. -- Mike Wendy Smoak wrote: this resulted in the ClassCastException i described earlier, despite reloading the webapp and even restarting tomcat. Did you also close the browser window you were using to test? IIRC, Tomcat serializes session data when you shut it down. Just a guess, but I think you had a session sitting around with the old form bean, and since the name was the same, it got used. If you had changed the name from the beginning (myForm2) you likely never would have seen this. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException using the DynaValidatorForm
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException using the DynaValidatorForm
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException using the DynaValidatorForm
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]