This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 1, 2011, 2:06 PM
6 Posts

Agressive ClassCastExceptions

  • Category: Custom JSF code (Eclipse IDE)
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: ClassCastException
  • Replies: 2
In my most complex XPages app, I've gotten myself into a situation where I start getting "X is incompatible with X" ClassCastExceptions whenever I re-save pretty much any design element, including things like CSS files that aren't even used by any of the XPages themselves and, on a lark, a navigator (!). It happens very reliably and immediately after saving a design element.

I've looked into it a bit and I've gathered that it's a known thing related to the way the classloaders work from several sources:

- http://stackoverflow.com/questions/5352550/meaning-of-java-lang-classcastexception-someclass-incompatible-with-someclass
- http://www.mindoo.com/web/blog.nsf/dx/05.02.2011131456KLEGDD.htm
- http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Creating_a_Java_Control_in_an_NSF#For+problems+in+the+faces-config+file

It sounds like the problem is generally resolved by spinning out the libraries to a filesystem JAR file, but that's something of a drag during active development.

I've mostly resigned myself to the notion that, whenever I save an XPage in this database, I have to re-save faces-config.xml or one of the back-end Java classes, but sometimes it arises on its own, even when I haven't touched the design at all that day. The exception generally deals with one specific bean, but I don't think that's the problem, since, if I remove the part that access that, it simply complains about the next bean I try to access.

I've been wracking my brain trying to figure out what's triggering it. Since it doesn't happen to other apps on the same server and DOES happen to this app on different servers (one 64-bit Windows and one 32-bit Linux), it's clearly something I've done, but it's not clear what. I've tried changing my session- and application-scoped beans to request scope, making everything Serializable, fiddling with the XPages options on the Application Properties document, changing the project Java compiler compatibility from the default 1.5 to 1.6, upgrading to each 8.5.2 fix pack as it comes out, and ensuring that no Domino product objects are stored in the session or application scopes.

Does anybody know of any other tripwires that could be triggering this that I should look out for?
Jul 4, 2011, 8:23 AM
14 Posts
Re: Agressive ClassCastExceptions
Hello, about a month ago I have discused this topic with Philippe Riand by mail. He stated 8.5.3 will change class loader behaviour to avoid this kind of troubles.
 
In short, any design change will trigger clas loader to "warm reset" what preserves session and application scoped variables, what leads to unusable application, if there is any object stored in that scope (including beans). Only solution is "cold reset", which will erase even ses/app variables - resave of face-config.xml. Class loader is too sensitive to design changes - it detects changes as: run of an agent (if it creates Agent Data Document) or change of some database level properties (enforce SSL and many other flags stored inside various design notes).
 
Frantisek Kossuth

Jul 26, 2011, 12:07 PM
6 Posts
Re: Agressive ClassCastExceptions
Excellent, thank you - one more reason to look forward to 8.5.3! I've worked around most of the immediate problems by switching to a singleton for the primary object, but I'm not terribly confident in that as a fix. It SEEMS to work, but it'll be good to give another shot to application- and session-scoped beans, since they're the "right" way to do it in the XPages environment.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal