Resource Files Are No Longer Found by MLet Class Loader in Java SE 6 (Doc ID 1343499.1)

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.

Symptoms

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."

Example
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:

<MLET NAME="RefAgent:name=Refer"
CODE="sample.Refer"
ARCHIVE="mail.jar,activation.jar,sample.jar"
CODEBASE="../lib/">
</MLET>

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.

Example
The example configuration above: 

ARCHIVE="mail.jar,activation.jar,sample.jar"


will not locate the jar file 'mail.jar' in Java SE 6. Instead, you can use:

ARCHIVE="sample.jar"


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. 

Cause

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