[jboss-jira] [JBoss JIRA] (AS7-3305) java.lang.IllegalAccessError when invoking protected method from another class in the same package path but different jar.
Stuart Douglas (JIRA)
jira-events at lists.jboss.org
Sun Jan 15 18:51:18 EST 2012
[ https://issues.jboss.org/browse/AS7-3305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas resolved AS7-3305.
---------------------------------
Assignee: Stuart Douglas (was: David Lloyd)
Resolution: Rejected
This happens because we use a different class loader to load each jar (i.e. it is a different module). The JVM considers packages to be different if they are defined in sperate class loaders.
If you really want to make this work you can use jboss-deployment-structure.xml to add the utility jar as a resource root of the ejb jar, rather than using Class-Path (see https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7)
In general, split packages are not a great idea, especially when they they use package private methods.
> java.lang.IllegalAccessError when invoking protected method from another class in the same package path but different jar.
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: AS7-3305
> URL: https://issues.jboss.org/browse/AS7-3305
> Project: Application Server 7
> Issue Type: Bug
> Components: Class Loading
> Affects Versions: 7.1.0.CR1b
> Environment: Windows 7 64 bit, Sun JDK 1.6.0_30 32bit
> Reporter: Rodney Kite
> Assignee: Stuart Douglas
>
> tried to access method com.tis.utilities.AbstractJavaBeanSelectionPagination.selectObject(IZ)V from class com.tis.utilities.GenericPaginationBean
> I have an EJB jar which uses a MANIFEST.MF CLASS-PATH: entry to include a jar with some utility code. The two jars are packaged in the same ear file. Compiles and deploys fine. For some reason the EJB jar's classes can not invoke protected methods in classes that are in the same package path but in different jars. Invocation of public methods works fine. By the Java spec protected methods should be friends and thus accessible from other classes in the same package path.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list