ClassCastException com.dev.model.Form cannot be cast to java.lang.String
Hello, I don't know if I m right posting here this, but I have this problem with my webapp and I couldn't find a solution I hope you can help me please: ERROR [httpSSLWorkerThread-8080-1] ActionComponent.executeAction(259) java.lang.ClassCastException: com.dev.model.Form cannot be cast to java.lang.String at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:409) I did search looking for an answer but I didnt find nothing... the thing is when I call an action method in a view: s:action name=createForm!getForm id=action namespace=default/ div id=box pstrongSurvey : /strong ${form.name}/p pstrongIntroduction : /strong ${form.introduction}/p pstrongClose Date:/strong ${form.close_date}/p br/ /div to show information about one Form. Please if you can guide me to solve this, Thanks in advance! Best Regards -- View this message in context: http://www.nabble.com/ClassCastException-com.dev.model.Form-cannot-be-cast-to-java.lang.String-tp22682861p22682861.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
2009/3/24 foward fow...@gmail.com: s:action name=createForm!getForm id=action namespace=default/ Method getForm() return object Form or String? Struts is expecting that action will return a String not an object. I think you should read some tutorial how to use Struts 2. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
lukaz, the method getForm() return a object Form where before with the respective id is obtained and returned. Yes I m reading a book struts in action, I don't know if you recomend me a good one. Regards Lukasz Lenart wrote: 2009/3/24 foward fow...@gmail.com: s:action name=createForm!getForm id=action namespace=default/ Method getForm() return object Form or String? Struts is expecting that action will return a String not an object. I think you should read some tutorial how to use Struts 2. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/ClassCastException-com.dev.model.Form-cannot-be-cast-to-java.lang.String-tp22682861p22683750.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
Look at your execute() method or whatever method you're calling from your JSP. I suspect that you are returning a com.dev.model.Form object instead of a String like success or input. jk On Tue, Mar 24, 2009 at 11:26 AM, foward fow...@gmail.com wrote: Hello, I don't know if I m right posting here this, but I have this problem with my webapp and I couldn't find a solution I hope you can help me please: ERROR [httpSSLWorkerThread-8080-1] ActionComponent.executeAction(259) java.lang.ClassCastException: com.dev.model.Form cannot be cast to java.lang.String at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:409) I did search looking for an answer but I didnt find nothing... the thing is when I call an action method in a view: s:action name=createForm!getForm id=action namespace=default/ div id=box pstrongSurvey : /strong ${form.name}/p pstrongIntroduction : /strong ${form.introduction}/p pstrongClose Date:/strong ${form.close_date}/p br/ /div to show information about one Form. Please if you can guide me to solve this, Thanks in advance! Best Regards -- View this message in context: http://www.nabble.com/ClassCastException-com.dev.model.Form-cannot-be-cast-to-java.lang.String-tp22682861p22682861.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
2009/3/24 foward fow...@gmail.com: the method getForm() return a object Form where before with the respective id is obtained and returned. You put method getForm() in s:form as a action, which means such method will be called by Struts 2 and the framework will expect a String - result name, which you have to define in struts.xml. You shouldn't return an object like Form. To do that, implement ModelDriven interface and return your Form object from method getModel() and in your jsp use ${name} instead ${form.name} Yes I m reading a book struts in action, I don't know if you recomend me a good one. That is good one Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
you have 2 different tags you are implementing: form (tag) which creates a form http://struts.apache.org/2.1.6/docs/form-tag.html action (tag) which identifies ActionClass (and possible parameters) http://struts.apache.org/2.1.6/docs/action.html did you have a question on either implementation? Martin __ Disclaimer and confidentiality note This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. Date: Tue, 24 Mar 2009 16:50:54 +0100 Subject: Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String From: lukasz.len...@googlemail.com To: user@struts.apache.org 2009/3/24 foward fow...@gmail.com: s:action name=createForm!getForm id=action namespace=default/ Method getForm() return object Form or String? Struts is expecting that action will return a String not an object. I think you should read some tutorial how to use Struts 2. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Internet Explorer 8 – Now Available. Faster, safer, easier. http://clk.atdmt.com/MRT/go/141323790/direct/01/
Re: OGNL ClassCastException
I use Sets too and they're not the problem here. The reason why this bug occurs is because the proxy that is returned by my entity bean is not recognised as an ArrayList by OGNL. Rather OGNL sees it as a Collection. I guess this is just a rare situation and a difficult one to follow. In this context on a stand-alone OGNL basis, it's not a problem. The problem is that struts.xml in the struts jar configures ognl to use XWorkCollectionPropertyAccessor for Collections and this class is badly mis-named. It is unable to deal with Collections that are Lists, because it extends ognl.SetPropertyAccessor which casts the Collection to a Set, causing a ClassCastException when acting on a List. In fact there is no ognl.CollectionPropertyAccessor so I created one and for now I'm going to override struts-default.xml to set OGNL to use my own XWorkCollectionPropertyAccessor. I appreciate that this is an edge case, but if you look at struts-default, you'll see the bean for type ognl.PropertyAccessor name=java.util.Collection and name=java.util.Set are the same and you'll appreciate the problem straight away when you look at the base class ognl.SetPropertAccessor. I'd be happy to enter a Jira, but the question is where: OGNL, XWork or Struts? Actually I'm having problems getting my version of struts-default.xml to be read. I thought I had to reference the file in struts.properties and have both in my classpath: struts.configuration.files = atomic-struts-default.xml but that doesn't work. Musachy Barroso on 16/02/09 00:24, wrote: It could be a bug, but I doubt it, I have used sets before and it works. Just as a test, try returning an empty HashSet from your method, instead of the proxy that it is returning now, and see if that works. musachy On Sun, Feb 15, 2009 at 7:14 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: Correct me if I'm wrong but this looks like a fundamental class mismatch. I can see in struts-default.xml that both Sets and Collections are configured to be accessed by the same PropertyAccessor. From debugging, I can see OGNL picks the PropertyAccessor for Collections to deal with my target property. Logical, since the ArrayList is an implementation of Collection. The problem is that struts has registered XWorkCollectionPropertyAccessor as the PropertyAccessor for Collections, but this extends ognl.SetPropertyAccessor which tries to cast the property to java.util.Set with the resulting ClassCastException. I noticed in an xwork jira that this seems to have happened before: http://jira.opensymphony.com/browse/XW-310 but that's fixed - unfortunately not helping me though. I can work around this by copying XWorkCollectionPropertyAccessor and writing a method to deal with Collections rather than Sets, but this is surely a bug. I'm just wondering why no-one else is suffering with it. Adam Hardy on 14/02/09 13:35, wrote: Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h
Re: OGNL ClassCastException
I figured out how to get my struts-default.xml to be loaded, in case you were going tell me how after I asked :O Consequently discovered that XWorkCollectionPropertyAccessor is actually compiled into Struts2 / XWork to allow work-arounds for OGNL, so it's not configurable. I'll build my own struts jar with modified source. Adam Hardy on 16/02/09 09:40, wrote: I use Sets too and they're not the problem here. The reason why this bug occurs is because the proxy that is returned by my entity bean is not recognised as an ArrayList by OGNL. Rather OGNL sees it as a Collection. I guess this is just a rare situation and a difficult one to follow. In this context on a stand-alone OGNL basis, it's not a problem. The problem is that struts.xml in the struts jar configures ognl to use XWorkCollectionPropertyAccessor for Collections and this class is badly mis-named. It is unable to deal with Collections that are Lists, because it extends ognl.SetPropertyAccessor which casts the Collection to a Set, causing a ClassCastException when acting on a List. In fact there is no ognl.CollectionPropertyAccessor so I created one and for now I'm going to override struts-default.xml to set OGNL to use my own XWorkCollectionPropertyAccessor. I appreciate that this is an edge case, but if you look at struts-default, you'll see the bean for type ognl.PropertyAccessor name=java.util.Collection and name=java.util.Set are the same and you'll appreciate the problem straight away when you look at the base class ognl.SetPropertAccessor. I'd be happy to enter a Jira, but the question is where: OGNL, XWork or Struts? Actually I'm having problems getting my version of struts-default.xml to be read. I thought I had to reference the file in struts.properties and have both in my classpath: struts.configuration.files = atomic-struts-default.xml but that doesn't work. Musachy Barroso on 16/02/09 00:24, wrote: It could be a bug, but I doubt it, I have used sets before and it works. Just as a test, try returning an empty HashSet from your method, instead of the proxy that it is returning now, and see if that works. musachy On Sun, Feb 15, 2009 at 7:14 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: Correct me if I'm wrong but this looks like a fundamental class mismatch. I can see in struts-default.xml that both Sets and Collections are configured to be accessed by the same PropertyAccessor. From debugging, I can see OGNL picks the PropertyAccessor for Collections to deal with my target property. Logical, since the ArrayList is an implementation of Collection. The problem is that struts has registered XWorkCollectionPropertyAccessor as the PropertyAccessor for Collections, but this extends ognl.SetPropertyAccessor which tries to cast the property to java.util.Set with the resulting ClassCastException. I noticed in an xwork jira that this seems to have happened before: http://jira.opensymphony.com/browse/XW-310 but that's fixed - unfortunately not helping me though. I can work around this by copying XWorkCollectionPropertyAccessor and writing a method to deal with Collections rather than Sets, but this is surely a bug. I'm just wondering why no-one else is suffering with it. Adam Hardy on 14/02/09 13:35, wrote: Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80
Re: OGNL ClassCastException
If you can create an xwork ticket and attach a patch it will be appreciated :) musachy On Mon, Feb 16, 2009 at 5:52 AM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I figured out how to get my struts-default.xml to be loaded, in case you were going tell me how after I asked :O Consequently discovered that XWorkCollectionPropertyAccessor is actually compiled into Struts2 / XWork to allow work-arounds for OGNL, so it's not configurable. I'll build my own struts jar with modified source. Adam Hardy on 16/02/09 09:40, wrote: I use Sets too and they're not the problem here. The reason why this bug occurs is because the proxy that is returned by my entity bean is not recognised as an ArrayList by OGNL. Rather OGNL sees it as a Collection. I guess this is just a rare situation and a difficult one to follow. In this context on a stand-alone OGNL basis, it's not a problem. The problem is that struts.xml in the struts jar configures ognl to use XWorkCollectionPropertyAccessor for Collections and this class is badly mis-named. It is unable to deal with Collections that are Lists, because it extends ognl.SetPropertyAccessor which casts the Collection to a Set, causing a ClassCastException when acting on a List. In fact there is no ognl.CollectionPropertyAccessor so I created one and for now I'm going to override struts-default.xml to set OGNL to use my own XWorkCollectionPropertyAccessor. I appreciate that this is an edge case, but if you look at struts-default, you'll see the bean for type ognl.PropertyAccessor name=java.util.Collection and name=java.util.Set are the same and you'll appreciate the problem straight away when you look at the base class ognl.SetPropertAccessor. I'd be happy to enter a Jira, but the question is where: OGNL, XWork or Struts? Actually I'm having problems getting my version of struts-default.xml to be read. I thought I had to reference the file in struts.properties and have both in my classpath: struts.configuration.files = atomic-struts-default.xml but that doesn't work. Musachy Barroso on 16/02/09 00:24, wrote: It could be a bug, but I doubt it, I have used sets before and it works. Just as a test, try returning an empty HashSet from your method, instead of the proxy that it is returning now, and see if that works. musachy On Sun, Feb 15, 2009 at 7:14 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: Correct me if I'm wrong but this looks like a fundamental class mismatch. I can see in struts-default.xml that both Sets and Collections are configured to be accessed by the same PropertyAccessor. From debugging, I can see OGNL picks the PropertyAccessor for Collections to deal with my target property. Logical, since the ArrayList is an implementation of Collection. The problem is that struts has registered XWorkCollectionPropertyAccessor as the PropertyAccessor for Collections, but this extends ognl.SetPropertyAccessor which tries to cast the property to java.util.Set with the resulting ClassCastException. I noticed in an xwork jira that this seems to have happened before: http://jira.opensymphony.com/browse/XW-310 but that's fixed - unfortunately not helping me though. I can work around this by copying XWorkCollectionPropertyAccessor and writing a method to deal with Collections rather than Sets, but this is surely a bug. I'm just wondering why no-one else is suffering with it. Adam Hardy on 14/02/09 13:35, wrote: Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set
Re: OGNL ClassCastException
Correct me if I'm wrong but this looks like a fundamental class mismatch. I can see in struts-default.xml that both Sets and Collections are configured to be accessed by the same PropertyAccessor. From debugging, I can see OGNL picks the PropertyAccessor for Collections to deal with my target property. Logical, since the ArrayList is an implementation of Collection. The problem is that struts has registered XWorkCollectionPropertyAccessor as the PropertyAccessor for Collections, but this extends ognl.SetPropertyAccessor which tries to cast the property to java.util.Set with the resulting ClassCastException. I noticed in an xwork jira that this seems to have happened before: http://jira.opensymphony.com/browse/XW-310 but that's fixed - unfortunately not helping me though. I can work around this by copying XWorkCollectionPropertyAccessor and writing a method to deal with Collections rather than Sets, but this is surely a bug. I'm just wondering why no-one else is suffering with it. Adam Hardy on 14/02/09 13:35, wrote: Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: OGNL ClassCastException
It could be a bug, but I doubt it, I have used sets before and it works. Just as a test, try returning an empty HashSet from your method, instead of the proxy that it is returning now, and see if that works. musachy On Sun, Feb 15, 2009 at 7:14 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: Correct me if I'm wrong but this looks like a fundamental class mismatch. I can see in struts-default.xml that both Sets and Collections are configured to be accessed by the same PropertyAccessor. From debugging, I can see OGNL picks the PropertyAccessor for Collections to deal with my target property. Logical, since the ArrayList is an implementation of Collection. The problem is that struts has registered XWorkCollectionPropertyAccessor as the PropertyAccessor for Collections, but this extends ognl.SetPropertyAccessor which tries to cast the property to java.util.Set with the resulting ClassCastException. I noticed in an xwork jira that this seems to have happened before: http://jira.opensymphony.com/browse/XW-310 but that's fixed - unfortunately not helping me though. I can work around this by copying XWorkCollectionPropertyAccessor and writing a method to deal with Collections rather than Sets, but this is surely a bug. I'm just wondering why no-one else is suffering with it. Adam Hardy on 14/02/09 13:35, wrote: Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: OGNL ClassCastException
Yes, it is a JPA entity bean proxied by OpenJPA. It has a list property - the bean is a parent in a parent-child relationship and this property is the list of children. This is the incoming HTTP parameter: portfolio.weightings[0]=123 Despite debugging it I am still not sure what has happened but I do see that OgnlRuntime looks up the appropriate PropertyAccessor in a map, and gets the wrong one back (SetPropertyAccessor instead of ListPropertyAccessor). Is there anything I can do to influence that? Regards Adam Musachy Barroso on 13/02/09 17:10, wrote: It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
OGNL ClassCastException
I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: OGNL ClassCastException
It seems like it is not a list but a proxy to it org.apache.openjpa.util.java$util$ArrayList$proxy which could be the root of the problem. musachy On Fri, Feb 13, 2009 at 12:00 PM, Adam Hardy ahardy.str...@cyberspaceroad.com wrote: I have a situation where OGNL seems to be misinterpreting the class of the HTTP parameter property it is setting during the ParameterInterceptor call. As you can see from the exception message, the object is an ArrayList and certainly not a Set which OGNL thinks it is. I have double, triple and quadruple checked that I am not using a Set at this point. How and where is OGNL deciding that this is a Set? And can I configure it? The HTTP parameter is 'myParameter[0]' and the List is a generic, assuming that makes a difference. java.lang.ClassCastException: org.apache.openjpa.util.java$util$ArrayList$proxy cannot be cast to java.util.Set at ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:46) at com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:80) at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643) at ognl.ASTProperty.getValueBody(ASTProperty.java:92) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
ClassCastException: org.apache.struts.taglib.html.MessagesTei
Hi, I have an old app which was developed under struts 1.2.8 using struts- tiles, and has undergone steady development. However, /AS FAR AS I KNOW/, no changes to the tags library files have been made for a long time. Yet today, after rebuilding the project (using Project Clean in Eclipse), I suddenly am getting this exception: java.lang.ClassCastException: org.apache.struts.taglib.html.MessagesTei (The full exception is shown at the end of this message) I don't recall ever seeing this before, and am not sure what to do to solve the problem. I'll greatly appreciate any suggestions anyone can offer. Thanks in advance, Ken Bowen Feb 3, 2009 12:14:27 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception java.lang.ClassCastException: org.apache.struts.taglib.html.MessagesTei at org .apache .jasper .compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:417) at org .apache .jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java: 250) at org .apache .jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java:163) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java: 431) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444) at org.apache.jasper.compiler.Parser.parse(Parser.java:138) at org .apache.jasper.compiler.ParserController.doParse(ParserController.java: 216) at org .apache.jasper.compiler.ParserController.parse(ParserController.java: 103) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282) at org .apache .jasper.JspCompilationContext.compile(JspCompilationContext.java:586) at org .apache .jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java: 630) at org .apache .catalina .core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java: 436) at org .apache .catalina .core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org .apache .catalina .core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org .apache.struts.action.RequestProcessor.doForward(RequestProcessor.java: 1063) at org .apache .struts .tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) at org .apache .struts .tiles .TilesRequestProcessor .processTilesDefinition(TilesRequestProcessor.java:239) at org .apache .struts .tiles .TilesRequestProcessor .internalModuleRelativeForward(TilesRequestProcessor.java:341) at org .apache .struts.action.RequestProcessor.processForward(RequestProcessor.java: 560) at org .apache.struts.action.RequestProcessor.process(RequestProcessor.java: 209) at org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 845) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Thread.java:613) Feb 3, 2009 12:14:27 PM
Re: Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
I put some @Conversion(), @Element(value = java.lang.Long.class) and @TypeConversion(rule = ConversionRule.COLLECTION, converter = java.lang.Long) in my Action and it's not working better. So I set the convertion in a properties file with : Element_idsCommerciaux=java.lang.Long and it is working, thanks Ralf. I tried to put v2.1.6 but I had a lot of trouble with EL expression (s:if test=${}, s:if test=#session...) which seemed to have changed, but I see nothing in the docs, release ntoes or migration guide, so I gave up (600 JSP to change and no time to do it) Thanks for your help. -- View this message in context: http://www.nabble.com/Random-ClassCastException-%3A-I%27m-expecting-Long%2C-Struts-gives-me-String-on-some-servers...-tp21722894p21743689.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
On Fri, Jan 30, 2009 at 10:10 AM, mleneveut mlenev...@abusinessware.com wrote: I put some @Conversion(), @Element(value = java.lang.Long.class) and @TypeConversion(rule = ConversionRule.COLLECTION, converter = java.lang.Long) in my Action and it's not working better. So I set the convertion in a properties file with : Element_idsCommerciaux=java.lang.Long and it is working, thanks Ralf. I tried to put v2.1.6 but I had a lot of trouble with EL expression (s:if test=${}, s:if test=#session...) which seemed to have changed, but I see nothing in the docs, release ntoes or migration guide, EL expressions attributes of struts tags which are evaluated on the ValueStack are a security risk. See [1]. Outside from struts tags you can still access objects on the valuestack, as struts intercepts the lookup to the page context. For the other way around you have to fully markup when you want to access the page context and such. ( foo=#attr.bar ). so I gave up (600 JSP to change and no time to do it) Take peace and comfort in the fact that you're not the only one who has/had to do this :-) Cheers, -Ralf [1] https://issues.apache.org/struts/browse/WW-2107 Thanks for your help. -- View this message in context: http://www.nabble.com/Random-ClassCastException-%3A-I%27m-expecting-Long%2C-Struts-gives-me-String-on-some-servers...-tp21722894p21743689.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
Hi all, I have a very strange thing. I have a multiple select in my JSP, and a ListLong of ids in my Action. When I submit the form, I iterate on that List of Long, and I have this error : java.lang.ClassCastException: java.lang.String Struts has String in the List instead of Long. The strange thing is that it appends on some servers (TomCat 5.5) but not on other : it works on my local computer, bug on the test server, works on the production server, and works on all other servers. I first thought it was a Struts dtd cache version problem on the Eclipse of the person building the WAR, but I have the same problem on my Eclipse (which build working WAR for other servers). We copied all jars files from shared/lib of a working TomCat to the bugging TomCat, but it doesn't fix the problem. Did someone already see such a thing ? Do you have an idea of where it could bug ? Thanks a lot. Here is my code : JSP : (id is a long, nomComplet is a String) s:select id=selectCommercial name=idsCommerciaux list=listCommercial listKey=id listValue=nomComplet cssStyle=width: 200 emptyOption=true multiple=true size=10 /s:select Action : private ListLong idsCommerciaux; public ListLong getIdsCommerciaux() { return idsCommerciaux; } public void setIdsCommerciaux(ListLong idsCommerciaux) { this.idsCommerciaux = idsCommerciaux; } for (Long unCommercial : idsCommerciaux) { //ClassCastException here Struts2 version : 2.1.0 -- View this message in context: http://www.nabble.com/Random-ClassCastException-%3A-I%27m-expecting-Long%2C-Struts-gives-me-String-on-some-servers...-tp21722894p21722894.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
Hi, On Thu, Jan 29, 2009 at 10:06 AM, mleneveut mlenev...@abusinessware.com wrote: Hi all, I have a very strange thing. I have a multiple select in my JSP, and a ListLong of ids in my Action. When I submit the form, I iterate on that List of Long, and I have this error : java.lang.ClassCastException: java.lang.String Struts has String in the List instead of Long. The strange thing is that it appends on some servers (TomCat 5.5) but not on other : it works on my local computer, bug on the test server, works on the production server, and works on all other servers. I first thought it was a Struts dtd cache version problem on the Eclipse of the person building the WAR, but I have the same problem on my Eclipse (which build working WAR for other servers). We copied all jars files from shared/lib of a working TomCat to the bugging TomCat, but it doesn't fix the problem. Did someone already see such a thing ? Do you have an idea of where it could bug ? Thanks a lot. Here is my code : JSP : (id is a long, nomComplet is a String) s:select id=selectCommercial name=idsCommerciaux list=listCommercial listKey=id listValue=nomComplet cssStyle=width: 200 emptyOption=true multiple=true size=10 /s:select Action : private ListLong idsCommerciaux; public ListLong getIdsCommerciaux() { return idsCommerciaux; } public void setIdsCommerciaux(ListLong idsCommerciaux) { this.idsCommerciaux = idsCommerciaux; } for (Long unCommercial : idsCommerciaux) { //ClassCastException here This seems like a type erasure problem. Reflection is used to set the entries into the list. As the generic type of the idsCommerciaux list is not available at runtime the no convertion to Long takes place for the List elements. So a List containing Strings is injected. Check out the Collection and Map Support portion from the type conversion documentation[1]. You might want use an ObjectTypeDeterminer I think. Struts2 version : 2.1.0 You should think about upgrading to 2.1.6, as it became GA recently. Cheers, -Ralf [1] http://struts.apache.org/2.0.14/docs/type-conversion.html -- View this message in context: http://www.nabble.com/Random-ClassCastException-%3A-I%27m-expecting-Long%2C-Struts-gives-me-String-on-some-servers...-tp21722894p21722894.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
Hi, Thanks for your reply. What I can't understand is why it works in some environments, and no others. The war is the same. And why do you say that the generic type of the idsCommerciaux list is not available at runtime ? I defined it as a ListLong in the Action. So Struts should know that it has to convert the data submitted to Long, doesn't it ? Ralf Fischer-2 wrote: Hi, This seems like a type erasure problem. Reflection is used to set the entries into the list. As the generic type of the idsCommerciaux list is not available at runtime the no convertion to Long takes place for the List elements. So a List containing Strings is injected. Check out the Collection and Map Support portion from the type conversion documentation[1]. You might want use an ObjectTypeDeterminer I think. Struts2 version : 2.1.0 You should think about upgrading to 2.1.6, as it became GA recently. Cheers, -Ralf [1] http://struts.apache.org/2.0.14/docs/type-conversion.html -- View this message in context: http://www.nabble.com/Random-ClassCastException-%3A-I%27m-expecting-Long%2C-Struts-gives-me-String-on-some-servers...-tp21722894p21729390.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Random ClassCastException : I'm expecting Long, Struts gives me String on some servers...
mleneveut wrote: What I can't understand is why it works in some environments, and no others. The war is the same. Probably because there were known bugs in 2.1.0 (both struts and xwork). As such, it was never intended for general use. The first GA (General Availability) 2.1.x was 2.1.6. Upgrade to an actual release and *then* see if the issue is resolved. If your bug remains then there might be people here motivated to help you. If you're just trying to find a bug that's already been fixed, I wouldn't expect that to motivate the *volunteers* here to respond. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: ClassCastException
this line: newuser = (User)getSession().save(user); Hernandez, David wrote: What line's the Exception being thrown on? -Original Message- From: slideharmony [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:35 AM To: user@struts.apache.org Subject: ClassCastException Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794434 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: ClassCastException
What's utente? In any case, you don't say where the exception is, but for whatever reason your DAO isn't getting a user (if that's where the exception is). d. --- slideharmony [EMAIL PROTECTED] wrote: Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - 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
What line's the Exception being thrown on? -Original Message- From: slideharmony [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:35 AM To: user@struts.apache.org Subject: ClassCastException Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ClassCastException
Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException
yes, it was the problem, I have solved it! thanks Nils-Helge Garli wrote: Assuming you're using Hibernate or something, the save method probably returns the generated identity of the stored object instance. So my guess is that you're getting the id of the user returned, which is a Long, and not a User object. Nils-H On 11/16/07, slideharmony [EMAIL PROTECTED] wrote: this line: newuser = (User)getSession().save(user); Hernandez, David wrote: What line's the Exception being thrown on? -Original Message- From: slideharmony [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:35 AM To: user@struts.apache.org Subject: ClassCastException Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794434 Sent from the Struts - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13795487 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException
Assuming you're using Hibernate or something, the save method probably returns the generated identity of the stored object instance. So my guess is that you're getting the id of the user returned, which is a Long, and not a User object. Nils-H On 11/16/07, slideharmony [EMAIL PROTECTED] wrote: this line: newuser = (User)getSession().save(user); Hernandez, David wrote: What line's the Exception being thrown on? -Original Message- From: slideharmony [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:35 AM To: user@struts.apache.org Subject: ClassCastException Hello, I have a problem saving a bean User. I use the following code: UserDao dao = new UserDao(); User user = new User(); Service.populate(user); dao.save(utente); if(user != null){ return SUCCESS; } here is the dao.save method: public User save(User user){ Utente newuser = null; begin(); newuser = (User)getSession().save(user); commit(); close(); return newuser; } this code throws a ClassCastException: java.lang.Long I have mapped all correctly, i have the same code that works perfectly in struts, but I get that exception with struts2. Can anybody help me? -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794339 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/ClassCastException-tf4821639.html#a13794434 Sent from the Struts - User mailing list archive at Nabble.com. - 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: [S2] ClassCastException on getParameters
Hi , Even i am also facing the same issue. If any body is having please share with us.. It is returning the String array[] . But how it will return string[] if we enter normal text also... Thanks Ravi On 8/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I'm having big trouble while trying to acces to the parameters values. I'm simply trying to retrieve a parameter value from my interceptor class. The Action class that is intercepted implements the ParameterAware interface and has getter and setter method related to parameters attribute which is a Map. Here is the sample code. public String intercept(ActionInvocation invocation) throws Exception { ActionSupport action = (ActionSupport) invocation.getAction(); Map session = invocation.getInvocationContext().getSession(); Map parameters = invocation.getInvocationContext().getParameters(); String loginAttempt = (String)parameters.get(Constants.LOGIN_ATTEMPT_KEY); return invocation.invoke (); } When the line in bold is reached, I' getting a ClassCastException. Here is an extract of the stacktrace java.lang.ClassCastException: [Ljava.lang.String; at com.natixis.media.interceptors.AuthenticationInterceptor.intercept( AuthenticationInterceptor.java:42) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile( UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke( DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java:221) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept( MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile( UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke( DefaultActionInvocation.java:221) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept( ValidationInterceptor.java:150) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept( MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling Can someone tells me what I'm missing. Thank in advance. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. Let us mind the environment : let's print our mails only when necessary.
Re: [S2] ClassCastException on getParameters
Why can't you access the HttpServletRequest object using ServletActionContext.getRequest() and then just use the getParameter() method to get the request parameters? If you're getting a ClassCastException it's because you're casting something that isn't a String to a String. Find out what the type of that object is and go from there. It's simple debugging really. Zarar On 8/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I'm having big trouble while trying to acces to the parameters values. I'm simply trying to retrieve a parameter value from my interceptor class. The Action class that is intercepted implements the ParameterAware interface and has getter and setter method related to parameters attribute which is a Map. Here is the sample code. public String intercept(ActionInvocation invocation) throws Exception { ActionSupport action = (ActionSupport) invocation.getAction(); Map session = invocation.getInvocationContext().getSession(); Map parameters = invocation.getInvocationContext().getParameters(); String loginAttempt = (String)parameters.get(Constants.LOGIN_ATTEMPT_KEY); return invocation.invoke (); } When the line in bold is reached, I' getting a ClassCastException. Here is an extract of the stacktrace java.lang.ClassCastException: [Ljava.lang.String; at com.natixis.media.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:42) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling Can someone tells me what I'm missing. Thank in advance. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. Let us mind the environment : let's print our mails only when necessary. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] ClassCastException on getParameters
Hi all, I'm having big trouble while trying to acces to the parameters values. I'm simply trying to retrieve a parameter value from my interceptor class. The Action class that is intercepted implements the ParameterAware interface and has getter and setter method related to parameters attribute which is a Map. Here is the sample code. public String intercept(ActionInvocation invocation) throws Exception { ActionSupport action = (ActionSupport) invocation.getAction(); Map session = invocation.getInvocationContext().getSession(); Map parameters = invocation.getInvocationContext().getParameters(); String loginAttempt = (String)parameters.get(Constants.LOGIN_ATTEMPT_KEY); return invocation.invoke (); } When the line in bold is reached, I' getting a ClassCastException. Here is an extract of the stacktrace java.lang.ClassCastException: [Ljava.lang.String; at com.natixis.media.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:42) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling Can someone tells me what I'm missing. Thank in advance. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natixis ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. Ensemble, faisons un geste pour l'environnement : n'imprimons nos mails que si necessaire The integrity of this message cannot be guaranteed on the Internet. Natixis can not therefore be considered responsible for the contents. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. Let us mind the environment : let's print our mails only when necessary.
RE: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug
Thank you Christian - you are correct. A colleague also referred me to: http://www.systemmobile.com/wp/?p=152 I had a copy of jsp-api.jar in my app (/WEB-INF/lib/jsp-api.jar) And Tomcat (both 5.0.28 and 5.5.9) has a copy under $CATALINA_HOME/common/lib/jsp-api.jar This makes the copy in my app redundant and it can safely be removed. By removing it, it resolves the ClassCastException with org.apache.struts.taglib.html.MessagesTei But why should this double presence of jsp-api.jar be a problem for Tomcat 5.5.9 but not for 5.0.28? Thank you, Stewart -Original Message- From: Christian Dionne [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 14:14 To: 'Struts Users Mailing List' Subject: RE: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug Hi Stewart, I had the same problem and I received a great answer on this mailing list a few days ago. The problem is caused by either one of these libraries that are conflicting with Struts: - jsp-api.jar - jsp-2.0-api.jar On my side, removing these libraries from my project (they were not used) solved the problem. Thanks, Christian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2005 6:24 AM To: [EMAIL PROTECTED]; user@struts.apache.org Subject: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug Using Struts 1.2.7 with the latest Tomcat 5.5.9 I get the following in localhost.date.log when I first try to access my web application: 17-Aug-2005 11:02:02 org.apache.catalina.core.Stand-ardHostValve custom SEVERE: Exception Processing ErrorPage[exceptionType=java.l-ang.Exception, location=/error.jsp] org.apache.jasper.JasperExcept-ion: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.-MessagesTei And in stdout_date.log I get: ERROR:org.apache.catalina.core-.ApplicationDispatcher.invoke(-Applicatio nDispatcher.java:704-) Servlet.service() for servlet jsp threw exception java.lang.ClassCastException: org.apache.struts.taglib.html.-MessagesTei Through trial and error I have found that this does not happen with Tomcat 5.0.28, with all other factors (struts, my application, etc) kept the same. Thought you all might like to know. Stewart - 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]
Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug
Using Struts 1.2.7 with the latest Tomcat 5.5.9 I get the following in localhost.date.log when I first try to access my web application: 17-Aug-2005 11:02:02 org.apache.catalina.core.Stand-ardHostValve custom SEVERE: Exception Processing ErrorPage[exceptionType=java.l-ang.Exception, location=/error.jsp] org.apache.jasper.JasperExcept-ion: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.-MessagesTei And in stdout_date.log I get: ERROR:org.apache.catalina.core-.ApplicationDispatcher.invoke(-Applicatio nDispatcher.java:704-) Servlet.service() for servlet jsp threw exception java.lang.ClassCastException: org.apache.struts.taglib.html.-MessagesTei Through trial and error I have found that this does not happen with Tomcat 5.0.28, with all other factors (struts, my application, etc) kept the same. Thought you all might like to know. Stewart
RE: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug
Hi Stewart, I had the same problem and I received a great answer on this mailing list a few days ago. The problem is caused by either one of these libraries that are conflicting with Struts: - jsp-api.jar - jsp-2.0-api.jar On my side, removing these libraries from my project (they were not used) solved the problem. Thanks, Christian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2005 6:24 AM To: [EMAIL PROTECTED]; user@struts.apache.org Subject: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug Using Struts 1.2.7 with the latest Tomcat 5.5.9 I get the following in localhost.date.log when I first try to access my web application: 17-Aug-2005 11:02:02 org.apache.catalina.core.Stand-ardHostValve custom SEVERE: Exception Processing ErrorPage[exceptionType=java.l-ang.Exception, location=/error.jsp] org.apache.jasper.JasperExcept-ion: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.-MessagesTei And in stdout_date.log I get: ERROR:org.apache.catalina.core-.ApplicationDispatcher.invoke(-Applicatio nDispatcher.java:704-) Servlet.service() for servlet jsp threw exception java.lang.ClassCastException: org.apache.struts.taglib.html.-MessagesTei Through trial and error I have found that this does not happen with Tomcat 5.0.28, with all other factors (struts, my application, etc) kept the same. Thought you all might like to know. Stewart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ClassCastException
I'm using Tomcat 5.5, JDK 1.5, Struts 1.2.7 and Tiles. I'm getting the following exception when I navigate to a Tiles page, I'm getting the following: java.lang.ClassCastException: org.apache.struts.taglib.tiles.UseAttributeTei at org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:420) at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248) at org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java:162) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1543) at org.apache.jasper.compiler.Parser.parse(Parser.java:126) Anybody got an idea about what's causing this and a potential fix/workaround? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What Are the Causes For Validation to Throw ClassCastException?
Do not understand the 'HTTP Status 500 - java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)' 1. I have this plug-in by the very end of the struts-config.xml file: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in 2. I have this action mapping in the struts-config.xml file: action path=/content/UpdateTitle type=org.dhsinfo.content.doSomething1 name=editTitleForm scope=request validate=true input=.frame.content forward name=success path=.title.Confirmation/ /action 3. I have this form-bean inside the form-beans element in the struts-config.xml file: form-bean name=editTitleForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.String/ form-property name=title type=java.lang.String/ /form-bean 4. I have the validation.xml file in the AppName/WEB-INF directory 4.1. I changed the beginning of the validation.xml file to http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; ): 4.2 my validation.xml file code is shown below I got the HTTP Status 500 - Servlet.service() for servlet action threw exception java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141) code: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation global constant constant-namepostalCode/constant-name constant-value^\d{5}\d*$/constant-value /constant /global formset form name=editTitleForm field property=page depends=required arg0 key=request.page/ /field field property=title depends=required arg0 key=insert.title/ /field /form /formset /form-validation __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What Are the Causes For Validation to Throw ClassCastException?
Caroline Jen wrote: Do not understand the 'HTTP Status 500 - java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)' 1. I have this plug-in by the very end of the struts-config.xml file: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in 2. I have this action mapping in the struts-config.xml file: action path=/content/UpdateTitle type=org.dhsinfo.content.doSomething1 name=editTitleForm scope=request validate=true input=.frame.content forward name=success path=.title.Confirmation/ /action 3. I have this form-bean inside the form-beans element in the struts-config.xml file: form-bean name=editTitleForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.String/ form-property name=title type=java.lang.String/ /form-bean 4. I have the validation.xml file in the AppName/WEB-INF directory 4.1. I changed the beginning of the validation.xml file to http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; ): 4.2 my validation.xml file code is shown below I got the HTTP Status 500 - Servlet.service() for servlet action threw exception java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141) code: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation global constant constant-namepostalCode/constant-name constant-value^\d{5}\d*$/constant-value /constant /global formset form name=editTitleForm field property=page depends=required arg0 key=request.page/ /field field property=title depends=required arg0 key=insert.title/ /field /form /formset /form-validation It appears as though the problem is with your use of a form-property called page - based on what I am seeing around line 141 of the DynaValidatorForm code, if you have a property named page, it MUST be an integer, otherwise classcastexception is thrown. I'm guessing this is to accomodate paged forms (aka wizards) Try changing the property to have another name, and I think it will fix your problem. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What Are the Causes For Validation to Throw ClassCastException?
I have changed the property from 'page' to 'pg'. The ClassCastException problem is gone. However, the validation.xml that I put in the AppName/WEB-INF is not doing anything. In my action mapping (struts-config.xml), I did set validate=true and in my validation.xml, I have required set for the depends attribute for every single text field. depends=required I intentionally left every field in those forms blank and submit forms. But, the Struts did not give me any warning about that I leave text fields blank. --- Matt Bathje [EMAIL PROTECTED] wrote: Caroline Jen wrote: Do not understand the 'HTTP Status 500 - java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)' 1. I have this plug-in by the very end of the struts-config.xml file: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in 2. I have this action mapping in the struts-config.xml file: action path=/content/UpdateTitle type=org.dhsinfo.content.doSomething1 name=editTitleForm scope=request validate=true input=.frame.content forward name=success path=.title.Confirmation/ /action 3. I have this form-bean inside the form-beans element in the struts-config.xml file: form-bean name=editTitleForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.String/ form-property name=title type=java.lang.String/ /form-bean 4. I have the validation.xml file in the AppName/WEB-INF directory 4.1. I changed the beginning of the validation.xml file to http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; ): 4.2 my validation.xml file code is shown below I got the HTTP Status 500 - Servlet.service() for servlet action threw exception java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141) code: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation global constant constant-namepostalCode/constant-name constant-value^\d{5}\d*$/constant-value /constant /global formset form name=editTitleForm field property=page depends=required arg0 key=request.page/ /field field property=title depends=required arg0 key=insert.title/ /field /form /formset /form-validation It appears as though the problem is with your use of a form-property called page - based on what I am seeing around line 141 of the DynaValidatorForm code, if you have a property named page, it MUST be an integer, otherwise classcastexception is thrown. I'm guessing this is to accomodate paged forms (aka wizards) Try changing the property to have another name, and I think it will fix your problem. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What Are the Causes For Validation to Throw ClassCastException?
Do you also have /AppName/WEB-INF/validator-rules.xml? Without that the validation won't work. Also make sure that you have the proper version of the validator jar. Assuming those things are correct, take a look through your tomcat logs, I bet you are actually getting an error of some sort. Matt Caroline Jen wrote: I have changed the property from 'page' to 'pg'. The ClassCastException problem is gone. However, the validation.xml that I put in the AppName/WEB-INF is not doing anything. In my action mapping (struts-config.xml), I did set validate=true and in my validation.xml, I have required set for the depends attribute for every single text field. depends=required I intentionally left every field in those forms blank and submit forms. But, the Struts did not give me any warning about that I leave text fields blank. --- Matt Bathje [EMAIL PROTECTED] wrote: Caroline Jen wrote: Do not understand the 'HTTP Status 500 - java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141)' 1. I have this plug-in by the very end of the struts-config.xml file: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in 2. I have this action mapping in the struts-config.xml file: action path=/content/UpdateTitle type=org.dhsinfo.content.doSomething1 name=editTitleForm scope=request validate=true input=.frame.content forward name=success path=.title.Confirmation/ /action 3. I have this form-bean inside the form-beans element in the struts-config.xml file: form-bean name=editTitleForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.String/ form-property name=title type=java.lang.String/ /form-bean 4. I have the validation.xml file in the AppName/WEB-INF directory 4.1. I changed the beginning of the validation.xml file to http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; ): 4.2 my validation.xml file code is shown below I got the HTTP Status 500 - Servlet.service() for servlet action threw exception java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:141) code: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation global constant constant-namepostalCode/constant-name constant-value^\d{5}\d*$/constant-value /constant /global formset form name=editTitleForm field property=page depends=required arg0 key=request.page/ /field field property=title depends=required arg0 key=insert.title/ /field /form /formset /form-validation It appears as though the problem is with your use of a form-property called page - based on what I am seeing around line 141 of the DynaValidatorForm code, if you have a property named page, it MUST be an integer, otherwise classcastexception is thrown. I'm guessing this is to accomodate paged forms (aka wizards) Try changing the property to have another name, and I think it will fix your problem. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What Are the Causes For Validation to Throw ClassCastException?
Jen, DynaValidatorForm ALREADY has a page field so leave it out: http://struts.apache.org/api/org/apache/struts/validator/DynaValidatorForm.h tml As for your validation not working with pg that's because the validator uses the field name page to figure out which validations to test in multi-page validations. Additionally, WHY are you requiring a page field in your formset? It should be a hidden variable out of the view of the user so there is no need to validate it. Without it, the plugIn should assume page=0 and do the most basic of validations in your formset. Regards, David -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 4:16 PM To: Struts Users Mailing List Subject: Re: What Are the Causes For Validation to Throw ClassCastException? I have changed the property from 'page' to 'pg'. The ClassCastException problem is gone. However, the validation.xml that I put in the AppName/WEB-INF is not doing anything. In my action mapping (struts-config.xml), I did set validate=true and in my validation.xml, I have required set for the depends attribute for every single text field. depends=required I intentionally left every field in those forms blank and submit forms. But, the Struts did not give me any warning about that I leave text fields blank. --- Matt Bathje [EMAIL PROTECTED] wrote: Caroline Jen wrote: Do not understand the 'HTTP Status 500 - java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.jav a:141)' 1. I have this plug-in by the very end of the struts-config.xml file: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in 2. I have this action mapping in the struts-config.xml file: action path=/content/UpdateTitle type=org.dhsinfo.content.doSomething1 name=editTitleForm scope=request validate=true input=.frame.content forward name=success path=.title.Confirmation/ /action 3. I have this form-bean inside the form-beans element in the struts-config.xml file: form-bean name=editTitleForm type=org.apache.struts.validator.DynaValidatorForm form-property name=page type=java.lang.String/ form-property name=title type=java.lang.String/ /form-bean 4. I have the validation.xml file in the AppName/WEB-INF directory 4.1. I changed the beginning of the validation.xml file to http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; ): 4.2 my validation.xml file code is shown below I got the HTTP Status 500 - Servlet.service() for servlet action threw exception java.lang.ClassCastException org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.jav a:141) code: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation global constant constant-namepostalCode/constant-name constant-value^\d{5}\d*$/constant-value /constant /global formset form name=editTitleForm field property=page depends=required arg0 key=request.page/ /field field property=title depends=required arg0 key=insert.title/ /field /form /formset /form-validation It appears as though the problem is with your use of a form-property called page - based on what I am seeing around line 141 of the DynaValidatorForm code, if you have a property named page, it MUST be an integer, otherwise classcastexception is thrown. I'm guessing this is to accomodate paged forms (aka wizards) Try changing the property to have another name, and I think it will fix your problem. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - 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 when usig multiple web applications
definition name=baseDef path=/am/WEB-INF/pages/mainLayout.jsp put name=menuPanel value=/am/amMenupanel.jsp/ change your tile-defs to not include the context name of your application ie definition name=baseDef path=/WEB-INF/pages/mainLayout.jsp put name=menuPanel value=/amMenupanel.jsp/ Also, why place your jsp's under WEB-INF ? Is there a security concern you are trying to overcome ? or were they just put there for no reason ? thanks Chris McCormack -Original Message- From: Mathew Joseph [mailto:[EMAIL PROTECTED] Sent: 06 July 2004 06:42 To: Struts Users Mailing List Subject: RE: ClassCastException when usig multiple web applications Hi The context name of my application is am . Here is the sample code of action class, struts-config, tiles-def web.xml ... ACTION CLASS *** //--- servlet --- import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; //--- struts --- import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.actions.DispatchAction; public final class ClassifiersAction extends DispatchAction { public static final String SOURCEREFID = $Name: $; $Id: ClassifiersAction.java,v 1.0 2004/06/30 12:12:12 mathew Exp $; private Vector messageVector; /** * Initial method for redirecting and loading Add,Search pages */ public ActionForward generalView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String sOpr = (String)request.getParameter(qOpr); if (sOpr != null) { if (sOpr.equals(add)) { return mapping.findForward(addPage); } } return mapping.findForward(defaultPage); } . } **struts-config.xml * action-mappings action path=/Classifiers type=com.alopa.xyz.ui.am.action.ClassifiersAction scope=request parameter=method forward name=addPage path=addPage/ /action . /action-mappings ***tiles-defs.xml*** tiles-definitions !-- Base definition for AM pages -- definition name=baseDef path=/am/WEB-INF/pages/mainLayout.jsp put name=menuPanel value=/am/amMenupanel.jsp/ put name=headerPanel value=/am/psHeader.jsp/ put name=tabPanel value=/ put name=messagePanel value=/am/WEB-INF/pages/psMessagepanel.jsp/ put name=bodyPanel value=/ put name=listPanel value=/ /definition !-- Definition for Classifiers - add pages -- definition name=addPage extends=baseDef put name=tabPanel value=/am/WEB-INF/pages/clfrHeader.jsp/' put name=bodyPanel value=/am/WEB-INF/pages/amClassifiers.jsp/ /definition . /tiles-definitions ***web.xml* servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/config/struts-config.xml/param-value /init-param Thanks Mathew -Original Message- From: McCormack, Chris [mailto:[EMAIL PROTECTED] Sent: Monday, July 05, 2004 7:38 PM To: Struts Users Mailing List Subject: RE: ClassCastException when usig multiple web applications Please paste in a sample action and a sample tile-def. The more info the easier it is to help you out. Also the name of your deployed app (context name). Chris McCormack -Original Message- From: Mathew Joseph [mailto:[EMAIL PROTECTED] Sent: 05 July 2004 15:07 To: [EMAIL PROTECTED] Subject: ClassCastException when usig multiple web applications Hi, We have deployed a ROOT application and another application called 'AM' in Tomcat 4.1.30. Both applications use struts. In struts config file as well as tiles definition files we have given all paths relative to context. Following exception is thrown, when action class is accessed. java.lang.ClassCastException at org.apache.struts.tiles.TilesRequestProcessor.initDefinitionsMapping(TilesRequestProcessor.java:126) at org.apache.struts.tiles.TilesRequestProcessor.init(TilesRequestProcessor.java:116
ClassCastException when usig multiple web applications
Hi, We have deployed a ROOT application and another application called 'AM' in Tomcat 4.1.30. Both applications use struts. In struts config file as well as tiles definition files we have given all paths relative to context. Following exception is thrown, when action class is accessed. java.lang.ClassCastException at org.apache.struts.tiles.TilesRequestProcessor.initDefinitionsMapping(TilesRequestProcessor.java:126) at org.apache.struts.tiles.TilesRequestProcessor.init(TilesRequestProcessor.java:116) at org.apache.struts.action.ActionServlet.getRequestProcessor(ActionServlet.java:872) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) 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:2422) 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:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163) 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:199) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) Please help us in solving this issue. Thanks Regards, Mathew Joseph Alopa Networks #50 , Vanivilas Road Basavanagudi Bangalore - 560004 Phone : 6618004 (204) Fax : 6618057
RE: ClassCastException when usig multiple web applications
Hi The context name of my application is am . Here is the sample code of action class, struts-config, tiles-def web.xml ... ACTION CLASS *** //--- servlet --- import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; //--- struts --- import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.actions.DispatchAction; public final class ClassifiersAction extends DispatchAction { public static final String SOURCEREFID = $Name: $; $Id: ClassifiersAction.java,v 1.0 2004/06/30 12:12:12 mathew Exp $; private Vector messageVector; /** * Initial method for redirecting and loading Add,Search pages */ public ActionForward generalView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String sOpr = (String)request.getParameter(qOpr); if (sOpr != null) { if (sOpr.equals(add)) { return mapping.findForward(addPage); } } return mapping.findForward(defaultPage); } . } **struts-config.xml * action-mappings action path=/Classifiers type=com.alopa.xyz.ui.am.action.ClassifiersAction scope=request parameter=method forward name=addPage path=addPage/ /action . /action-mappings ***tiles-defs.xml*** tiles-definitions !-- Base definition for AM pages -- definition name=baseDef path=/am/WEB-INF/pages/mainLayout.jsp put name=menuPanel value=/am/amMenupanel.jsp/ put name=headerPanel value=/am/psHeader.jsp/ put name=tabPanel value=/ put name=messagePanel value=/am/WEB-INF/pages/psMessagepanel.jsp/ put name=bodyPanel value=/ put name=listPanel value=/ /definition !-- Definition for Classifiers - add pages -- definition name=addPage extends=baseDef put name=tabPanel value=/am/WEB-INF/pages/clfrHeader.jsp/' put name=bodyPanel value=/am/WEB-INF/pages/amClassifiers.jsp/ /definition . /tiles-definitions ***web.xml* servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/config/struts-config.xml/param-value /init-param Thanks Mathew -Original Message- From: McCormack, Chris [mailto:[EMAIL PROTECTED] Sent: Monday, July 05, 2004 7:38 PM To: Struts Users Mailing List Subject: RE: ClassCastException when usig multiple web applications Please paste in a sample action and a sample tile-def. The more info the easier it is to help you out. Also the name of your deployed app (context name). Chris McCormack -Original Message- From: Mathew Joseph [mailto:[EMAIL PROTECTED] Sent: 05 July 2004 15:07 To: [EMAIL PROTECTED] Subject: ClassCastException when usig multiple web applications Hi, We have deployed a ROOT application and another application called 'AM' in Tomcat 4.1.30. Both applications use struts. In struts config file as well as tiles definition files we have given all paths relative to context. Following exception is thrown, when action class is accessed. java.lang.ClassCastException at org.apache.struts.tiles.TilesRequestProcessor.initDefinitionsMapping(TilesRequestProcessor.java:126) at org.apache.struts.tiles.TilesRequestProcessor.init(TilesRequestProcessor.java:116) at org.apache.struts.action.ActionServlet.getRequestProcessor(ActionServlet.java:872) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke
struts ClassCastException
My web-app runs great when first starting JBoss. After making src changes to my web-app, I build, and redeploy using ant. I then attempt to test my changes by going down the exact same html:link navigation as before, only to receive a ClassCastException from org.apache.util.RequestUtils.createActionForm(RequestUtils.java: 777) Any pointers would be greatly appreciated. JBoss 3.2.3 JDK 1.4.2 -- Kevin J Citron Sr. Object Imagineer Optimized Objects, Inc. EL Paso, Texas 79930 (915) 566-2403 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem of ClassCastException when ArrayList to My own Class
Check if your Array list.size in actionForm isnt 0. And i suggest dont instantiate a new Array object in Form bean becoz when your setter method failed for some reason, when you do get you wont get any error becoz you create an empty ArrayList and it will be returned. Its better if you only declare or set it to null, so you will get exception when it return null. --- ganesh g [EMAIL PROTECTED] wrote: Hi Friends, ThanQ very much 4ur non-stop help towards me. Here is a problem with Typecasting,throws ClassCastException. I'm not able get why it's getting.Bcoz i spent on this problem around 2weeks. i'm very thankful to u for ur solution. Problem of Area is as Follows: i've myown class called FileProperties Step:1 public class FileProperties { private long fileSize; private Date fileDate; private String filename; private String filepath; private String clientid; ...some other properties.. public FileProperties() { } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getFilepath() { return filepath; } public void setFilepath(String filepath) { this.filepath = filepath; } ...some other getter/setter methods. } Step:2 In actionForm called mtActionForm i declared as follows: public class MtActionForm extends ActionForm { private FileProperties singleFile; private Collection mtJobsList=new ArrayList(); ...some other properties.. public Collection getMtJobsList() { return mtJobsList; } public void setMtJobsList(Collection mtJobsList) { this.mtJobsList = mtJobsList; } public FileProperties getSingleFile() { return singleFile; } public void setSingleFile(FileProperties singleFile) { this.singleFile = singleFile; } } Now i'm showing u exact problem of Area Step:3 MtActionForm mtForm = (MtActionForm)actionForm; String tempStr = httpServletRequest.getParameter(fileIndex); int index = Integer.parseInt(tempStr); ArrayList aList = (ArrayList)mtForm.getMtJobsList();//No exception Here FileProperties sFile =(FileProperties )aList.get(index);//This is where ClassCastException thrown mtForm.setSingleFile(sFile); Step:4 In Jsp i'm going to use as follows bean:write name=mtActionForm property=singleFile.filename/ I'm eagerly awaiting your reply as soon as possible. Thanks Regards Ganesh - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ = == thx, a Java Student __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]