2 Replies Latest reply on Jul 14, 2004 9:10 AM by Per Olesen

    3.2.3 IllegalAccessError on private inner class

    Guy Rouillier Newbie

      We have an EJB that works fine under 2.4.3. I'm moving our environment to 3.2.3 (finally!). This EJB has a private inner class (tried making it public, no difference.) It compiles and deploys fine, but at runtime I get this error:

      2004-05-19 17:31:24,105 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error:
      java.lang.IllegalAccessError: tried to access class com.masergy.ejb.billing.BillingBean$LocalTierUpdateData from class com.masergy.ejb.billing.BillingBean
      at com.masergy.ejb.billing.BillingBean.generateTiered95thRecords(BillingBean.java:1340)

      At this line of code, it is trying to construct an object of the inner class LocalTierUpdateData. I worked around this by just creating a separate public class in the same package. But why would an inner class get an illegal access error?

        • 1. Re: 3.2.3 IllegalAccessError on private inner class
          Adrian Brock Master

          You are trying to load it from a different classloader.

          • 2. Re: 3.2.3 IllegalAccessError on private inner class
            Per Olesen Newbie

            Hmm, I'm getting something like it. How do you now that he is loading the inner class in a separate classloader? Is it something to do with it being inner?

            I also have a class, which instantiates an inner.class, where the inner class is inner in the class instantiating it. It compiles fine, and the class and inner class is deployed in the same jarfile? But at runtime, I get the following exception:

            java.lang.IllegalAccessError: tried to access class dk.nve.fibernet.nablegw.model.MetadataDB$CategoryCompareCategoryComparator from class dk.nve.fibernet.nablegw.model.MetadataDB

            How can any of these two classes be loaded in another classloader?

            If it really is the classloader that is the issue, what can I then do, to make them load from same classloader?