Hi,

I've been using struts for a while, now, and my system is deployed on jboss+tomcat. Until version 4.0.1, JBoss came with Tomcat 5.0.x embedded, but with 4.0.2, Tomcat was upgraded to 5.5.x, and I started having a strange problem. It manifests itself as this exception:

java.lang.ClassCastException: org.apache.struts.validator.BeanValidatorForm

Now, this happens when I typecast the "form" parameter in the "execute" method to my own ActionForm bean:

MyActionForm maf = (MyActionForm)form;

BTW,

public class MyActionForm extends AbstractMyActionForm

public abstract class AbstractMyActionForm extends ActionForm

Debugging the code reveals that at the offending line, "form" is of type BeanValidatorForm, that has a field "dynaClass" of type "WrapDynaBean", that has a field "instance" of type MyActionForm.

Now, my application is packaged as an ear file, which contains an ejb-jar and a war, where the Action class exists. On closer inspection, I find out that the problem is related to the fact that I package AbstractMyActionForm in the ejb-jar. If I change my structure (for testing purposes) so that it is packaged in the war instead, the problem goes away. Unfortunatelly that is not possible in the real application. Note: if I have the class on both ejb-jar and war files, the problem still occurs.

I suspect the problem is related to the ClassLoader, but, as the debug session shows, the abstract class is eventually found by the classloader (since the "instance" variable of WrapDynaBean contains a valid instance of the class).

Any hints?

Just to repeat myself: this works fine under JBoss 4.0.1/Tomcat 5.0.x

Zorzella

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to