| Author |
number of class loaders in a small java project
|
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
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 .
|
Save India From Corruption - Anna Hazare.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12325
|
|
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
|
Java Resources at www.wbrogden.com
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
|
Thanks , i solved that exception , just for the sake of knowledge transfer i posted this question .
|
 |
 |
|
|
subject: number of class loaders in a small java project
|
|
|