• Post Reply Bookmark Topic Watch Topic
  • New Topic

number of class loaders in a small java project  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • 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 .
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks , i solved that exception , just for the sake of knowledge transfer i posted this question .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!