• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

number of class loaders in a small java project

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

While practicing with Collections , i got a ClassCastException , so when searching for the reasons of getting ClassCastException i found this one :

A class cast exception results when the following conditions exist and can be corrected by the following actions:

* The type of the source object is not an instance of the target class (type).

* The class loader that loaded the source object (class) is different from the class loader that loaded the target class.

* The application fails to perform or improperly performs a narrow operation.

(This is taken from IBM tutorials)

Please tell me something about the second point as my question is how many classloaders will be present in a Java Application (I am not using any server or not using any custom classloaders ).

Thank you .
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Typically only one class loader - a great simplification.

I would certainly look elsewhere for the problem.

There should be details attached to the exception, what does the stack trace say?

Bill
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks , i solved that exception , just for the sake of knowledge transfer i posted this question .
 
reply
    Bookmark Topic Watch Topic
  • New Topic