This article relates to working with JavaMail (classes in the javax.mail package) and Java Activation (classes in the javax.activation package) when running inside Weblogic.
When AEM is running inside Weblogic, functionality from JavaMail is provided by the application server. Depending on the JRE version, Java Activation is provided by the JRE or by Weblogic.
In order to use JavaMail and JavaActivation in this case, the bundles for them need to be uninstalled:
Then, the associated packages need to be provided by the system bundle. This can be done by installing a system bundle extension fragment for these bundles, see this article on how to make a System Bundle extension on how to do this. Care must be taken to ensure that the exported versions of the packages as declared in the fragment matches the versions provided by the application server/JRE.
An alternative approach to the system bundle extension, is to add a framework property that declares that these packages are provided by the system bundle (as it inherits them from its parent classloader). This is done by modifying the sling.properties file to contain the following line (this line shows Java Activation only):
Again, it's important to ensure that the right version is used for the export. The version of Java Activation included in the JRE is 1.1. Information about the version of JavaMail as provided by JavaEE can be found in the OSGi Protable Java Contracts page: http://www.osgi.org/Specifications/ReferenceContract.