6 Replies Latest reply on Sep 11, 2013 3:39 AM by jaikiran pai

    java.lang.IllegalAccessError Jboss EAP 6.1

    surendrand001 Newbie

      Hi,

           

      I am getting IllegalAccessError when trying to access a class on different ejb jar with same package.

       

      My Project structure is as follows

       

      ShoppingEAR

      |__META-INF/application.xml

      |__META-INF/jboss-deployment-structure.xml

      |__FrameWork.jar (EJB)

      |__FrameWorkData.jar (Java)

      |__ShoppingWeb.war (Web)

       

      com.client.fw.ValidationController (@Stateless) - Framework.jar

      com.client.fw.UserDataDto - FrameworkData.jar

       

      I am trying to access a protected method in UserDataDto  from ValidationController

       

      When I access I am getting exception as follows

       

      Caused by: java.lang.IllegalAccessError: tried to access method com.client.fw.UserDataDto.setUserName(Ljava/lang/String;)V from class com.client.fw.ValidationController

          at com.client.fw.ValidationController.validateLogin(ValidationController.java:18) [Framework.jar:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_17]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_17]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_17]

       

       

      I understand that jboss 7 uses different classloaders for loading my jar files. But also stated <ear-subdeployments-isolated>false</ear-subdeployments-isolated> should allow my classes in different jars to see each other.

       

      I my case classes are able to see each other but not able to access the protected method in UserDataDto. (this EAR structure was working in eap 4.3)

       

      How do I resolve this issue. I need to make com.client.fw.ValidationController (in Framework.jar) to access protected methods in com.client.fw.UserDataDto(FrameworkData)

       

      Note: Attached my complete log file and workspace files

       

      Regards,

      Surendran