Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[angus-dev] Trying to use angus in OSGi context

Hi all,

I've an Eclipse RCP project which should send mails via a simple dialog. Formerly, I've used javax.mail. Now, I've tried to use angus, but this doesn' t work because of this error:

Mai 28, 2024 9:39:23 PM jakarta.mail.Session loadResource
WARNUNG: expected resource not found: /META-INF/javamail.default.address.map
DEBUG: failed to load address map, using defaults
Mai 28, 2024 9:45:24 PM jakarta.mail.Session loadResource
WARNUNG: expected resource not found: /META-INF/javamail.default.address.map
jakarta.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
    boundary="----=_Part_0_614850410.1716925547697"
    at jakarta.activation.ObjectDataContentHandler.writeTo(DataHandler.java:872)
    at jakarta.activation.DataHandler.writeTo(DataHandler.java:291)
    at jakarta.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1683)
    at jakarta.mail.internet.MimeMessage.writeTo(MimeMessage.java:1911)
    at org.eclipse.angus.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1305)
    at jakarta.mail.Transport.send0(Transport.java:233)
    at jakarta.mail.Transport.send(Transport.java:102)
    at org.myproject.connectors.mail.MailService.lambda$4(MailService.java:342)     at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)

So, the problem is, that the angus plugin doesn't find the map file, because it's running in an OSGi context where no classloader resolving works. Instead, one has to use the following construct:

org.osgi.framework.FrameworkUtil.getBundle(MailStreamProvider.class).getResource("/META-INF/javamail.providers")

But I don't know how to say to angus that it's running in an OSGi context and has to use the other resource resolving strategy. Any hints are welcome.

Thanks in advance,

Ralf.







Back to the top