You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Chandan Singh <ma...@gmail.com> on 2025/03/07 11:19:31 UTC

Issue with Sending Mail with PDF attachments

Hi All ,

We had an app to send smtp emails with pdf attachments , post upgrade to
Karaf 4.4.6 we are facing issue in sending emails with attachments , normal
emails works , the same code works out side in an Standalone program .  but
in the container it throws below error .

Anyone have any information on it?

akarta.mail.MessagingException: IOException while sending message
at
org.eclipse.angus.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1355)
~[?:?]
at jakarta.mail.Transport.send0(Transport.java:233) ~[?:?]
at jakarta.mail.Transport.send(Transport.java:102) ~[?:?]


 at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
[!/:9.4.54.v20240208]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164)
[!/:9.4.54.v20240208]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
[!/:9.4.54.v20240208]
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
[!/:9.4.54.v20240208]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
[!/:9.4.54.v20240208]
at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: jakarta.activation.UnsupportedDataTypeException: no object DCH
for MIME type multipart/mixed;
boundary="----=_Part_0_1421178140.1741345627105"
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:1913) ~[?:?]
at
org.eclipse.angus.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1305)
~[?:?]

Have these dependencies

<!-- Jakarta Mail (Full Implementation, NOT just API) -->

<dependency>

<groupId>com.sun.mail</groupId>

<artifactId>jakarta.mail</artifactId>

<version>2.0.1</version>

</dependency>


<!-- Jakarta Activation API (For handling attachments) -->

<dependency>

<groupId>jakarta.activation</groupId>

<artifactId>jakarta.activation-api</artifactId>

<version>2.0.1</version>

</dependency>


<!-- SLF4J Logger Implementation (To fix SLF4J warnings) -->

<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-simple</artifactId>

<version>1.7.32</version>

</dependency>


Regards

Chandan

Re: Issue with Sending Mail with PDF attachments

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Chandan Singh <ma...@gmail.com>:

> The same code works fine in 4.3.10 but fails in 4.4.6  .  Any changes done
> related to mail in 4.4.6

Yes, but:
 1. Do a "mvn dependency:tree" and take a look at if javamail is shown
    as a transitive dependency of dependencies and if different
    dependencies list different versions
then
 2. Do a "bundle:list | grep -i javamail" in the karaf command line
    after loading your project, to see if you can see more than one
    javamail with different versions
    If you see no matches, try with a lower start level,
    e.g. "bundle:list -t 20 | grep -i javamail"

If both of those hold true that would be an indication that different
OSGi bundles might use different versions of javamail (which could cause
seemingly the same type, not to be so in OSGi... different
classloaders).

You can try doing the command in "2." in 4.4.6 as well to see if things
look different there.

(Note: this is just looking for a possible cause, and not a suggestion
for a cure)


Re: Issue with Sending Mail with PDF attachments

Posted by Chandan Singh <ma...@gmail.com>.
The same code works fine in 4.3.10 but fails in 4.4.6  .  Any changes done
related to mail in 4.4.6

Regards
Chandan

On Fri, Mar 7, 2025 at 7:53 PM Steinar Bang <sb...@dod.no> wrote:

> No direct knowledge of the tools you're using, but a google for the
> error methods gave me this:
>  https://github.com/bbottema/simple-java-mail/issues/117
>
> Could it be possible that you have multiple versions of javaMail loaded
> in karaf and that you are using one version in the place where you are
> calling the code and another where it is used (or different versions at
> different places in the call stack)?
>
> If so: I can see how this could make mime types not recognized when
> looking for a handler.
>
> Just a thought.
>
>

Re: Issue with Sending Mail with PDF attachments

Posted by Steinar Bang <sb...@dod.no>.
No direct knowledge of the tools you're using, but a google for the
error methods gave me this:
 https://github.com/bbottema/simple-java-mail/issues/117

Could it be possible that you have multiple versions of javaMail loaded
in karaf and that you are using one version in the place where you are
calling the code and another where it is used (or different versions at
different places in the call stack)?

If so: I can see how this could make mime types not recognized when
looking for a handler.

Just a thought.