Prev: IllegalAccessError - Super/sub-types loaded with different classloaders
Next: IllegalAccessError - Super/sub-types loaded with different classloaders
From: Zeba on 25 Jul 2010 05:56 On Jul 25, 1:53 pm, Alan Gutierrez <a...(a)blogometer.com> wrote: > Zeba wrote: > > My problem is that after I get an ExtendedSampleBO object, if I try to > > access the methods of the super-type (SampleBO), I get > > IllegalAccessError. How do I solve this problem??!! > > Re-stating my requirement - Client needs to set some values in a BO. > > The framework has to provides a mechanism for dynamically extending > > the functionality of the BO by using binary files deployed to the > > database. > > Could it be the case that the special database reading `ClassLoader` > that loads `ExtendedSampleBO` is *not* a child of the `ClassLoader` that > loaded `SampleBO`, because if not, then the special database reading > `ClassLoader` is going to create its own `SampleBO` class and that will > be different from the application's `SampleBO` class. > > I'm not sure how that would throw an `IllegalAccessError` and not a > `ClassCastException`, but it would be the first thing I'd look at. > > -- > Alan Gutierrez - a...(a)blogometer.com -http://twitter.com/bigeasy Ohh :( That's the problem then. Actually the application has a large number of Rule-set's (binary files), each of which is loaded from db by its own classloader. However, all of these Rule-sets have a common Master ( also loaded from db by a separate classloader ). So instead of loading the Master binary files from the db for each of the Child- set's, I just save a reference to the master class-loader and use that within the Rule-set's class-loaders to load the files ( to save memory by avoiding same classes being loaded multiple times over multiple classloaders - there will be a large number of Rule-set's). Is there any other solution than making the Master classloader a child of the Rule-set classloader?? Zeba
From: Zeba on 25 Jul 2010 06:02
On Jul 25, 2:56 pm, Zeba <coolz...(a)gmail.com> wrote: > On Jul 25, 1:53 pm, Alan Gutierrez <a...(a)blogometer.com> wrote: > > > > > Zeba wrote: > > > My problem is that after I get an ExtendedSampleBO object, if I try to > > > access the methods of the super-type (SampleBO), I get > > > IllegalAccessError. How do I solve this problem??!! > > > Re-stating my requirement - Client needs to set some values in a BO. > > > The framework has to provides a mechanism for dynamically extending > > > the functionality of the BO by using binary files deployed to the > > > database. > > > Could it be the case that the special database reading `ClassLoader` > > that loads `ExtendedSampleBO` is *not* a child of the `ClassLoader` that > > loaded `SampleBO`, because if not, then the special database reading > > `ClassLoader` is going to create its own `SampleBO` class and that will > > be different from the application's `SampleBO` class. > > > I'm not sure how that would throw an `IllegalAccessError` and not a > > `ClassCastException`, but it would be the first thing I'd look at. > > > -- > > Alan Gutierrez - a...(a)blogometer.com -http://twitter.com/bigeasy > > Ohh :( That's the problem then. Actually the application has a large > number of Rule-set's (binary files), each of which is loaded from db > by its own classloader. However, all of these Rule-sets have a common > Master ( also loaded from db by a separate classloader ). So instead > of loading the Master binary files from the db for each of the Child- > set's, I just save a reference to the master class-loader and use that > within the Rule-set's class-loaders to load the files ( to save memory > by avoiding same classes being loaded multiple times over multiple > classloaders - there will be a large number of Rule-set's). > > Is there any other solution than making the Master classloader a child > of the Rule-set classloader?? > > Zeba Missed one point - ExtendedSampleBO is in the Master-set. SampleBO is a class loaded by the parent of Rule-set's classloader. Thanks much! Zeba |