Resource Files Are No Longer Found by MLet Class Loader in Java SE 6
Last updated on NOVEMBER 05, 2016
Applies to:Java Platform, Standard Edition - Version 6 to 6 [Release 6]
Information in this document applies to any platform.
There is a change in the class loading behavior between Java SE 5.0, where JAF (JavaBeans Activation Framework) is used as an unbundled component, and JavaSE 6 and 7, where JAF is integrated.
1. Java SE 5.0 + JAF
With Java SE 5.0 + JAF, it is possible to configure the MLet class loader (javax.management.loading.MLet) in such a way that additional jar files are found. This can be done in the MLet tag attribute, "ARCHIVE."
The following example uses 3 jar files:
'activation.jar' contains the unbundled JAF classes
'sample.jar' contains the MBean code
'mail.jar' is an additional jar file
The following code shows that additional jar file 'mail.jar' is configured with the MLet class loader:
Without any further configuration, the jar file 'mail.jar' and all its resources are found in the Java application running on Java SE 5.0, if the default class loader for 'javax.activation' classes is being used.
This behavior changes in Java SE 6, where JAF is integrated.
2. Java SE 6 and Later
Beginning with Java SE 6, the classpath needs to be configured in order to find additional jar files. This is Java SE standard behavior. However, the MLet class loader is still used to load the MBean classes.
The example configuration above:
will not locate the jar file 'mail.jar' in Java SE 6. Instead, you can use:
with 'sample.jar' containing the MBean code.
Additionally, the classpath needs to be configured with the path to the jar file 'mail.jar' in order to locate the file correctly: "./lib/mail.jar."
Please note: the jar 'activation.jar' is no longer needed, because all of the JAF code is contained within Java SE 6.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms