Copy link to clipboard
Copied
Hi,
I don't know if anyone can throw any light onto this? I have a bunch of Java code that uses Hibernate to interact with the database. I am trying to put a CF web front on to display some information. I wrote a very small Java CFX as a gateway into my Java codebase. Somewhat surprisingly to me it was actually very easy to get it more-or-less working. In fact, if I use non-generics code I can display values straight from my database onto a webpage.
I have a valid Hibernate Query object that I call .list on. The list contains Country objects (say). If I loop over the list as 'objects' and ay call the toString method (which in turns calls Country specific methods) it works fine, however if I try and cast to a Country object I get a ClassCastException saying it cannot cast Country to Country.
The only thing I can think of is that the 'two' Country classes (conceptually they is just a single class, of course) cannot be cast to each other because they were loaded by different classloaders.
Anyone have any idea?
Cheers,
Andy
I am using CF8, Java 1.6 and Hibernate 3.
Copy link to clipboard
Copied
Okay, my bad. Maybe noone else will have this problem, but rather than delete my questions ...
So I had accidentally left one of my jars in the cfroot/lib directory (so it was being loaded by the boot class loader). When I removed it it was correctly picked up from the runtime directory (using the App class loader).
Copy link to clipboard
Copied
Glad you solved it .. and thanks for posting a follow-up!