eclipse-ee4j / eclipse-ee4j/angus-mail
MailcapCommandMap can not load Mime Handlers in OSGI Runtime
- Dominant language
- Java
- Stars
- 87
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
We are trying to move from Javax to Jakarta dependencies in OSGI but we can not find a set of runtime dependencies for the Jakarta Mail and Jakarta Activation.
I have following JARs in the OSGI Runtime:
jakarta.activation:jakarta.mail-api.jar (version 2.1.2)
org.eclipse.angus:jakarta.mail.jar (version 2.0.3)
jakarta.activation:jakarta.activation-api.jar (version 2.1.3)
org.eclipse.angus:angus-activation.jar (version 2.0.2)
We get following error as we try to send an Email in MailcapCommandMap:
Can't load DCH org.eclipse.angus.mail.handlers.multipart_mixed; Exception: java.lang.ClassNotFoundException: org.eclipse.angus.mail.handlers.multipart_mixed not found by jakarta.activation-api [39]
How should the MailcapCommandMap find the correct class Loader for the "multipart_mixed" handler?
cld = SecuritySupport.getContextClassLoader(); -> loads the application class loader and it does not contain multipart_mixed handlers.
cld = this.getClass().getClassLoader(); -> loads the bundle class loader for jakarta.activation-api als does not contain multipart_mixed handlers.
cl = Class.forName(name); -> same class loader as this.getClass().getClassLoader().
None of the above loaded the handlers correctly.
Our current idea is putting all JARs from above into a single bundle as dependencies and export everyting from the same bundle which is sharing the same class loader as a workaround solution.
How should it be working in the OSGI runtime?
Contributor guide
Research direction
Start with MailcapCommandMap and its SecuritySupport.getContextClassLoader(), getClass().getClassLoader(), and Class.forName(name) paths. Reproduce the multipart_mixed handler lookup with the four listed JARs in an OSGi runtime and trace which bundle owns each class. Done means the handler loads successfully without the reported ClassNotFoundException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100