1 Reply Latest reply on Nov 13, 2002 8:39 AM by juha

    java.lang.IllegalAccessError, JBOSS 2.4.x -> JBOSS 3.0.4

    sasgon

      Hi2all,
      I've got some strange problems when I tried to migrate application from JBOSS2 to JBOSS3 ( JDK 1.3.1_01 )

      Input data:
      I have a tested and worked application based on JBOSS 2.4.x. I got a task to migrate to JBOSS 3.0.4.
      I have created necessary configuration and launched unit tests and .... I've got:

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerError: Unexpected Error; nested exception is:
      java.lang.IllegalAccessError: try to access method event.EventSourceAddress.getSource()Levent/EventSource; from class
      event.SingularEventSink java.rmi.ServerError: Unexpected Error; nested exception is:
      java.lang.IllegalAccessError: try to access method event.Event SourceAddress.getSource()Levent/EventSource;
      from class event.SingularEventSink java.lang.IllegalAccessError: try to access method event.EventSourceAddress.getSource()Levent/EventSource;
      from class event.SingularEventSink
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:138)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy2.registerAtSource(Unknown Source)
      at event.EventTest.testRegistrationViaSink(EventTest.java:233)


      !!!!
      try to access method event.EventSourceAddress.getSource()Levent/EventSource; from class event.SingularEventSink
      !!!!

      YES, the method EventSourceAddress.getSource() is PROTECTED,
      BUT the invoker class SingularEventSink is located in the same package 'event' !!!

      HOW it could be?

      These classes are located in one of the jar common.jar packaged to application.ear.
      The classes from common.jar are shared between others jar files from application.ear.

      MANIFEST.MF.EJB file contains description:
      Manifest-Version: 1.0
      Class-Path: ./common.jar

      I have looked througt JBOSS loading trace file, the common.jar package is loaded only once when application.ear started to deploy.


      I did small test and move all protected classes and methods in the package 'event' to public, all tests passed OK.

      Please Could Somebody explain me, why it happend?

      Why two classes from the same package cannot access protected methods each other after they have been loaded
      by NEW JBOSS ClassLoader architecture ?

      Thank You in advance,
      Alexander.

        • 1. Re: java.lang.IllegalAccessError, JBOSS 2.4.x -> JBOSS 3.0.4

          If the classes in your package are spread out to different deployment units (jars, wars, ears, sars, rars, wsrs, etc) they get loaded by separate classloaders. This breaks the package private (protected) visibility. So for example, if your EAR contains an EJB jar and a utility lib commons.jar, these two packages get different classloaders. Package private visibility won't work across these two archives.