Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [angus-dev] Trying to use angus in OSGi context
  • From: Jason Mehrens <jason_mehrens@xxxxxxxxxxx>
  • Date: Fri, 31 May 2024 05:10:34 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UcY/38RXL4cigtFTNn3dWDaexEmgIszuOThyUNFzxXc=; b=Vy6C8f99nucqy39CY2bngAPefQqxyY3kY12lcVwU/2PKKzwhgiUGLtStYKymtKynZhF7QgwLZ1kz9dTq53gKM1e1EItFXzjIgm+MlNPYukbMs6ZgVi7vLUjEa713rR3zqXM4VjK0aFUTEqMq2/w+5rDqByMqUFVEbilhROQfZNgSASIvf9HXbvZb4numNBKlWhNaPzzgaUVMUNVtybr4PZ6ez3FXmUy4+DuFYXm0z4fWEyD/Z2QFzhevMbmXY0XLJFrHTS5NFZ/yCNkm4ejEDNgLdI+joayx5Gk/eBCwUIHHb7BFtoExl4IKvT44ZGs29tblb2rxCOJ9dYxlXqsjUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HPnPPowjHMN7cph1V/VqM0wZsLkHqBE+d838gX7RD2dgVlyiS2LI+nHaj+9Sw7Tyk8rc5BWebtZlO++Ra1laZ1doUQnOKN9qeVGZXDKOXEQzAKCWM3brxj1bFwvhyzsO0QKy/qKWKYp1C0v51VzrbPIvGmbA2yqH7rIFrTN7ramgy1jRDQUSuJRrby2KaGqgVDmm2jZz+QSo1pen68JTQigp0HdQ8QeneBu1oAAGzHrDW/BDpLY7MVao5o8WkbZcEFniAVOuvR/uhQ0RAvjh/yLgaacaNSmd6RJkOy52KTuItO5r205fWhYsCTd3w5xi77Lcvogy1BitycO8gjGmuQ==
  • Delivered-to: angus-dev@xxxxxxxxxxx
  • List-archive: <http://www.eclipse.org/mailman/private/angus-dev/>
  • List-help: <mailto:angus-dev-request@eclipse.org?subject=help>
  • List-subscribe: <http://www.eclipse.org/mailman/listinfo/angus-dev>, <mailto:angus-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <http://www.eclipse.org/mailman/options/angus-dev>, <mailto:angus-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHasThggPcVg9FlIkyVrdpFBDVT+bGwyV+1
  • Thread-topic: [angus-dev] Trying to use angus in OSGi context

Hi Ralf,

This is an issue that I'm working on.  Take a look at:
http://github.com/eclipse-ee4j/angus-mail/issues/148

I'm still evaluating thus issue but I think the problem is that jakartamail needs to make activation consult it's implemention for the resource file.

Jenkins was able to latest release working but they use a custom build of activation to make it work in osgi.

The only workarounds I know of are to:
1. Bundle the 4 dependencies in the same osgi bundle/classloader.
2. Implemented what Jenkins is doing with activation.
3. Try changing the thread context classloader during send to the s.getStreamProvider().getClass().getClassLoader().  Where 's' is the mail session you created or fetched from a message. I haven't tested this.
4. Try creating a proxy classloader that delegates most calls but uses FrameworkUtil to return resources.  I haven't tested this either.


Jason

From: angus-dev <angus-dev-bounces@xxxxxxxxxxx> on behalf of Ralf Heydenreich via angus-dev <angus-dev@xxxxxxxxxxx>
Sent: Tuesday, May 28, 2024 2:50 PM
To: angus-dev@xxxxxxxxxxx <angus-dev@xxxxxxxxxxx>
Cc: Ralf Heydenreich <rheydenr@xxxxxxxxxxx>
Subject: [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.





_______________________________________________
angus-dev mailing list
angus-dev@xxxxxxxxxxx
To unsubscribe from this list, visit http://accounts.eclipse.org

Back to the top