How To Stop java.lang.ClassCastException Error?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How To Stop java.lang.ClassCastException Error?

BrettS
Hi,

I have made a small modification to RequestHandler.java that compiles, but causes ClassCastException errors. Can anyone tell me what I am doing wrong please? Details as follows.

I have inserted the following line of code into RequestHandler.java.
Profile profile=Profile.getProfile(request);

This Profile class does not "know" anything about OFBiz. Profile's supporting JAR files are located in:
ofbiz\specialpurpose\ecommerce\webapp\ecommerce\WEB-INF\lib

There are also *essential* related servlet filters configured in
ofbiz\specialpurpose\ecommerce\webapp\ecommerce\WEB-INF\web.xml

I have ecommerce JSPs and FTLs that utilize the profile class successfully. Furthermore, I can build OFBiz with this RequestHandler.java modification.

However, when I attempt behavior that runs the said line of code, OFBiz throws the following error:
java.lang.ClassCastException: com.mycompany.mypackage.Profile cannot be cast to com.mycompany.mypackage.Profile

The message seems odd to me because it says a class cannot be cast as itself. I am wondering if I need to copy the supporting jar files and web.xml changes somewhere else.

Any suggestions?

Thank you.

Regards

Brett S