• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF8 with Java CFX / Hibernate - ClassCastException

Guest
Aug 27, 2009 Aug 27, 2009

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.

TOPICS
Advanced techniques

Views

717

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 27, 2009 Aug 27, 2009

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 27, 2009 Aug 27, 2009

Copy link to clipboard

Copied

LATEST

Glad you solved it .. and thanks for posting a follow-up!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation