You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Speckels, Bert" <Be...@btc-ag.com> on 2023/03/18 10:27:39 UTC

Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Hello everyone

Maybe you have a hint for me where to look for a solution.
I started to use "decanter" to send emails for error logging. 

I started to use the following features:
   <feature>decanter-collector-log</feature>
   <feature>decanter-appender-log</feature>
   <feature>decanter-alerting-email</feature>

... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
   rule.error="{'condition':'message:*','level':'ERROR'}"

... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"

But when decanter tries to send an email the following error is logged:

Caused by: javax.activation.UnsupportedDataTypeException: text/plain
      at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
      at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
      at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]


Does anyone have an idea what is missing? 
I am a little bit confused and could not find any source of information about this problem.

I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2

karaf@root()> feature:list | grep decanter | grep Started
decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter

Thanx for any help
Bert Speckels

Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Paul,

Let me check what's wrong with the decanter-alerting-email feature.

Regards
JB

On Wed, Mar 22, 2023 at 6:21 PM Paul Spencer <pa...@mindspring.com> wrote:
>
> JB,
> I have been able to install the email alerter from Decanter v2.10 without using the feature.  In short I used a different version of Java Mail and the activation api then defined in the decanter-alerting-email-core feature.
>
> ***
> * Karaf 4.4.3 command to install Decanter Alerting Email outside of the feature
> ***
> feature:install scr
> bundle:install mvn:com.sun.activation/jakarta.activation/1.2.1
> bundle:install mvn:com.sun.mail/jakarta.mail/1.6.7
> bundle:install --start mvn:org.apache.karaf.decanter.alerting/org.apache.karaf.decanter.alerting.email/2.10.0
>
>
> Paul Spencer
>
> > On Mar 22, 2023, at 9:04 AM, Speckels, Bert <Be...@btc-ag.com> wrote:
> >
> > Thanx alot
> >
> > Currently there is no hurry yet for email support but later planned (May 2023).
> > But I'll will give Decanter 2.9.0 a try.
> >
> > For testing we are currently using "smtp4dev" docker image.
> > Greenmail seems to be a very good alternative!
> >
> > Mit freundlichen Grüßen
> >
> > i.A. Bert Speckels
> > BU Software Factory
> > Smart Software Solutions
> >
> > BTC Business Technology Consulting AG
> > Escherweg 3
> > 26121 Oldenburg
> > Tel:      +49 441 3612-2294
> > Mobil:   +49 174 3436354
> > Fax:     +49 441 3612-3999
> > E-Mail:  Bert.Speckels@btc-ag.com
> > Web:     www.btc-ag.com
> >
> > Rechtliche Hinweise:
> > www.btc-ag.com/impressum.htm
> > Handelsregister: Amtsgericht Oldenburg HRB 4717
> > Aufsichtsratsvorsitzender: Wolfgang Mücher
> > Vorstand: Dr. Jörg Ritter (Vorstandsvorsitzender), Percy Hamer
> >
> >
> > Von: Paul Spencer <pa...@mindspring.com>
> > Gesendet: Dienstag, 21. März 2023 18:28
> > An: user@karaf.apache.org <us...@karaf.apache.org>
> > Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
> >
> > Bert,
> > You can test alerts with Decanter 2.9.0 on Karaf 4.3.x in the interim.
> >
> > Since it is very easy to create an email storm, I suggest using a tool like Greenmail, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgreenmail-mail-test.github.io%2Fgreenmail%2F%23deploy_standalone&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=suFF%2BPkAnkzoS5hd65hqBlwiPenpVQgwixM65%2FivccA%3D&reserved=0, as an email server for testing.
> >
> >
> > Paul Spencer
> >
> >
> > > On Mar 21, 2023, at 1:21 PM, Speckels, Bert <Be...@btc-ag.com> wrote:
> > >
> > > Perfect Paul!
> > >
> > > Thanx alot for your work to reproduce my problem here.
> > >
> > > @Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂
> > >
> > > So currently there is no easy solution for decanter alerts using email?
> > >
> > > Von: Paul Spencer <pa...@me.com>
> > > Gesendet: Dienstag, 21. März 2023 15:57
> > > An: user@karaf.apache.org <us...@karaf.apache.org>
> > > Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
> > >
> > > JB,
> > > I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OAKste8%2Bt4Ljbu%2B9TftnF8hDHSu7c3kxejCH0jUj%2FlU%3D&reserved=0
> > >
> > > # Start karaf
> > > bin/karaf clean
> > >
> > > # Add decanter repo and install email alerting feature
> > > feature:repo-add decanter
> > > feature:install decanter-alerting-email
> > >
> > > # Edit etc/org.apache.karaf.decanter.alerting.email.cfg
> > >
> > > # Send an event the alerter
> > > event:send decanter/alert/ERROR “foo=bar”
> > >
> > > # Display the karaf.log
> > > log:display
> > >
> > > 10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
> > > 10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
> > > 10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
> > > 10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
> > > 10:52:25.777 INFO [features-3-thread-1] Done.
> > > 10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
> > > javax.mail.MessagingException: IOException while sending message
> > > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
> > > at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
> > > at javax.mail.Transport.send(Transport.java:174) ~[?:?]
> > > at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
> > > at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
> > > at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
> > > at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
> > > at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
> > > at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
> > > at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
> > > at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
> > > at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
> > > at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
> > > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
> > > at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> > > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
> > > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
> > > at java.lang.Thread.run(Thread.java:833) ~[?:?]
> > > Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> > > at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> > > at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> > > at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> > > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> > > ... 22 more
> > >
> > > karaf@root()>
> > >
> > >
> > >
> > > > On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> > > >
> > > > Hi Bert
> > > >
> > > > Let me try to reproduce. Do you use a mail template ?
> > > >
> > > > Regards
> > > > JB
> > > >
> > > > On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> > > > <Be...@btc-ag.com> wrote:
> > > >>
> > > >> Hello everyone
> > > >>
> > > >> Maybe you have a hint for me where to look for a solution.
> > > >> I started to use "decanter" to send emails for error logging.
> > > >>
> > > >> I started to use the following features:
> > > >>   <feature>decanter-collector-log</feature>
> > > >>   <feature>decanter-appender-log</feature>
> > > >>   <feature>decanter-alerting-email</feature>
> > > >>
> > > >> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
> > > >>   rule.error="{'condition':'message:*','level':'ERROR'}"
> > > >>
> > > >> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
> > > >>
> > > >> But when decanter tries to send an email the following error is logged:
> > > >>
> > > >> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> > > >> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> > > >> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> > > >> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> > > >> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> > > >>
> > > >>
> > > >> Does anyone have an idea what is missing?
> > > >> I am a little bit confused and could not find any source of information about this problem.
> > > >>
> > > >> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
> > > >>
> > > >> karaf@root()> feature:list | grep decanter | grep Started
> > > >> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> > > >> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> > > >> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> > > >> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> > > >> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> > > >> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
> > > >>
> > > >> Thanx for any help
> > > >> Bert Speckels
> >
>

Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Paul Spencer <pa...@mindspring.com>.
JB,
I have been able to install the email alerter from Decanter v2.10 without using the feature.  In short I used a different version of Java Mail and the activation api then defined in the decanter-alerting-email-core feature. 

***
* Karaf 4.4.3 command to install Decanter Alerting Email outside of the feature
***
feature:install scr
bundle:install mvn:com.sun.activation/jakarta.activation/1.2.1
bundle:install mvn:com.sun.mail/jakarta.mail/1.6.7
bundle:install --start mvn:org.apache.karaf.decanter.alerting/org.apache.karaf.decanter.alerting.email/2.10.0


Paul Spencer

> On Mar 22, 2023, at 9:04 AM, Speckels, Bert <Be...@btc-ag.com> wrote:
> 
> Thanx alot
> 
> Currently there is no hurry yet for email support but later planned (May 2023).
> But I'll will give Decanter 2.9.0 a try. 
> 
> For testing we are currently using "smtp4dev" docker image.
> Greenmail seems to be a very good alternative!
> 
> Mit freundlichen Grüßen
> 
> i.A. Bert Speckels
> BU Software Factory
> Smart Software Solutions
> 
> BTC Business Technology Consulting AG
> Escherweg 3
> 26121 Oldenburg
> Tel:      +49 441 3612-2294
> Mobil:   +49 174 3436354
> Fax:     +49 441 3612-3999
> E-Mail:  Bert.Speckels@btc-ag.com
> Web:     www.btc-ag.com
> 
> Rechtliche Hinweise:
> www.btc-ag.com/impressum.htm
> Handelsregister: Amtsgericht Oldenburg HRB 4717
> Aufsichtsratsvorsitzender: Wolfgang Mücher
> Vorstand: Dr. Jörg Ritter (Vorstandsvorsitzender), Percy Hamer
> 
> 
> Von: Paul Spencer <pa...@mindspring.com>
> Gesendet: Dienstag, 21. März 2023 18:28
> An: user@karaf.apache.org <us...@karaf.apache.org>
> Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
>  
> Bert,
> You can test alerts with Decanter 2.9.0 on Karaf 4.3.x in the interim.
> 
> Since it is very easy to create an email storm, I suggest using a tool like Greenmail, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgreenmail-mail-test.github.io%2Fgreenmail%2F%23deploy_standalone&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=suFF%2BPkAnkzoS5hd65hqBlwiPenpVQgwixM65%2FivccA%3D&reserved=0, as an email server for testing.
> 
> 
> Paul Spencer
> 
> 
> > On Mar 21, 2023, at 1:21 PM, Speckels, Bert <Be...@btc-ag.com> wrote:
> > 
> > Perfect Paul!
> > 
> > Thanx alot for your work to reproduce my problem here.
> > 
> > @Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂
> > 
> > So currently there is no easy solution for decanter alerts using email?
> > 
> > Von: Paul Spencer <pa...@me.com>
> > Gesendet: Dienstag, 21. März 2023 15:57
> > An: user@karaf.apache.org <us...@karaf.apache.org>
> > Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
> >  
> > JB,
> > I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OAKste8%2Bt4Ljbu%2B9TftnF8hDHSu7c3kxejCH0jUj%2FlU%3D&reserved=0
> > 
> > # Start karaf
> > bin/karaf clean
> > 
> > # Add decanter repo and install email alerting feature
> > feature:repo-add decanter
> > feature:install decanter-alerting-email
> > 
> > # Edit etc/org.apache.karaf.decanter.alerting.email.cfg
> > 
> > # Send an event the alerter
> > event:send decanter/alert/ERROR “foo=bar”
> > 
> > # Display the karaf.log 
> > log:display
> > 
> > 10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
> > 10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
> > 10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
> > 10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
> > 10:52:25.777 INFO [features-3-thread-1] Done.
> > 10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
> > javax.mail.MessagingException: IOException while sending message
> > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
> > at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
> > at javax.mail.Transport.send(Transport.java:174) ~[?:?]
> > at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
> > at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
> > at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
> > at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
> > at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
> > at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
> > at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
> > at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
> > at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
> > at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
> > at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
> > at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
> > at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
> > at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
> > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
> > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
> > at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
> > at java.lang.Thread.run(Thread.java:833) ~[?:?]
> > Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> > at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> > at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> > at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> > at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> > ... 22 more
> > 
> > karaf@root()>  
> > 
> > 
> > 
> > > On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> > > 
> > > Hi Bert
> > > 
> > > Let me try to reproduce. Do you use a mail template ?
> > > 
> > > Regards
> > > JB
> > > 
> > > On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> > > <Be...@btc-ag.com> wrote:
> > >> 
> > >> Hello everyone
> > >> 
> > >> Maybe you have a hint for me where to look for a solution.
> > >> I started to use "decanter" to send emails for error logging.
> > >> 
> > >> I started to use the following features:
> > >>   <feature>decanter-collector-log</feature>
> > >>   <feature>decanter-appender-log</feature>
> > >>   <feature>decanter-alerting-email</feature>
> > >> 
> > >> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
> > >>   rule.error="{'condition':'message:*','level':'ERROR'}"
> > >> 
> > >> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
> > >> 
> > >> But when decanter tries to send an email the following error is logged:
> > >> 
> > >> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> > >> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> > >> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> > >> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> > >> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> > >> 
> > >> 
> > >> Does anyone have an idea what is missing?
> > >> I am a little bit confused and could not find any source of information about this problem.
> > >> 
> > >> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
> > >> 
> > >> karaf@root()> feature:list | grep decanter | grep Started
> > >> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> > >> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> > >> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> > >> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> > >> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> > >> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
> > >> 
> > >> Thanx for any help
> > >> Bert Speckels
> 


AW: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by "Speckels, Bert" <Be...@btc-ag.com>.
Thanx alot

Currently there is no hurry yet for email support but later planned (May 2023).
But I'll will give Decanter 2.9.0 a try.

For testing we are currently using "smtp4dev" docker image.
Greenmail seems to be a very good alternative!

Mit freundlichen Grüßen

i.A. Bert Speckels
BU Software Factory
Smart Software Solutions

BTC Business Technology Consulting AG
Escherweg 3
26121 Oldenburg
Tel:      +49 441 3612-2294
Mobil:   +49 174 3436354
Fax:     +49 441 3612-3999
E-Mail:  Bert.Speckels@btc-ag.com
Web:     www.btc-ag.com

Rechtliche Hinweise:
www.btc-ag.com/impressum.htm
Handelsregister: Amtsgericht Oldenburg HRB 4717
Aufsichtsratsvorsitzender: Wolfgang Mücher
Vorstand: Dr. Jörg Ritter (Vorstandsvorsitzender), Percy Hamer



________________________________
Von: Paul Spencer <pa...@mindspring.com>
Gesendet: Dienstag, 21. März 2023 18:28
An: user@karaf.apache.org <us...@karaf.apache.org>
Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Bert,
You can test alerts with Decanter 2.9.0 on Karaf 4.3.x in the interim.

Since it is very easy to create an email storm, I suggest using a tool like Greenmail, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgreenmail-mail-test.github.io%2Fgreenmail%2F%23deploy_standalone&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=suFF%2BPkAnkzoS5hd65hqBlwiPenpVQgwixM65%2FivccA%3D&reserved=0, as an email server for testing.


Paul Spencer


> On Mar 21, 2023, at 1:21 PM, Speckels, Bert <Be...@btc-ag.com> wrote:
>
> Perfect Paul!
>
> Thanx alot for your work to reproduce my problem here.
>
> @Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂
>
> So currently there is no easy solution for decanter alerts using email?
>
> Von: Paul Spencer <pa...@me.com>
> Gesendet: Dienstag, 21. März 2023 15:57
> An: user@karaf.apache.org <us...@karaf.apache.org>
> Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
>
> JB,
> I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7C9dbfa29aa5a6482767f308db2a31af85%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150165105714954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OAKste8%2Bt4Ljbu%2B9TftnF8hDHSu7c3kxejCH0jUj%2FlU%3D&reserved=0
>
> # Start karaf
> bin/karaf clean
>
> # Add decanter repo and install email alerting feature
> feature:repo-add decanter
> feature:install decanter-alerting-email
>
> # Edit etc/org.apache.karaf.decanter.alerting.email.cfg
>
> # Send an event the alerter
> event:send decanter/alert/ERROR “foo=bar”
>
> # Display the karaf.log
> log:display
>
> 10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
> 10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
> 10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
> 10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
> 10:52:25.777 INFO [features-3-thread-1] Done.
> 10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
> javax.mail.MessagingException: IOException while sending message
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
> at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
> at javax.mail.Transport.send(Transport.java:174) ~[?:?]
> at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
> at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
> at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
> at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
> at java.lang.Thread.run(Thread.java:833) ~[?:?]
> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> ... 22 more
>
> karaf@root()>
>
>
>
> > On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> >
> > Hi Bert
> >
> > Let me try to reproduce. Do you use a mail template ?
> >
> > Regards
> > JB
> >
> > On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> > <Be...@btc-ag.com> wrote:
> >>
> >> Hello everyone
> >>
> >> Maybe you have a hint for me where to look for a solution.
> >> I started to use "decanter" to send emails for error logging.
> >>
> >> I started to use the following features:
> >>   <feature>decanter-collector-log</feature>
> >>   <feature>decanter-appender-log</feature>
> >>   <feature>decanter-alerting-email</feature>
> >>
> >> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
> >>   rule.error="{'condition':'message:*','level':'ERROR'}"
> >>
> >> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
> >>
> >> But when decanter tries to send an email the following error is logged:
> >>
> >> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> >> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> >> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> >> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> >> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> >>
> >>
> >> Does anyone have an idea what is missing?
> >> I am a little bit confused and could not find any source of information about this problem.
> >>
> >> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
> >>
> >> karaf@root()> feature:list | grep decanter | grep Started
> >> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> >> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> >> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> >> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> >> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> >> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
> >>
> >> Thanx for any help
> >> Bert Speckels


Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Paul Spencer <pa...@mindspring.com>.
Bert,
You can test alerts with Decanter 2.9.0 on Karaf 4.3.x in the interim.

Since it is very easy to create an email storm, I suggest using a tool like Greenmail, https://greenmail-mail-test.github.io/greenmail/#deploy_standalone, as an email server for testing.


Paul Spencer


> On Mar 21, 2023, at 1:21 PM, Speckels, Bert <Be...@btc-ag.com> wrote:
> 
> Perfect Paul!
> 
> Thanx alot for your work to reproduce my problem here.
> 
> @Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂
> 
> So currently there is no easy solution for decanter alerts using email?
> 
> Von: Paul Spencer <pa...@me.com>
> Gesendet: Dienstag, 21. März 2023 15:57
> An: user@karaf.apache.org <us...@karaf.apache.org>
> Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
>  
> JB,
> I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7Cb9254dbaf8534596f5db08db2a1ca655%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150074770709219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CgEsWPuxgkvLjB2MTlYEQKRxnBZ2NZOV0CIxrSeahwY%3D&reserved=0
> 
> # Start karaf
> bin/karaf clean
> 
> # Add decanter repo and install email alerting feature
> feature:repo-add decanter
> feature:install decanter-alerting-email
> 
> # Edit etc/org.apache.karaf.decanter.alerting.email.cfg
> 
> # Send an event the alerter
> event:send decanter/alert/ERROR “foo=bar”
> 
> # Display the karaf.log 
> log:display
> 
> 10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
> 10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
> 10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
> 10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
> 10:52:25.777 INFO [features-3-thread-1] Done.
> 10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
> javax.mail.MessagingException: IOException while sending message
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
> at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
> at javax.mail.Transport.send(Transport.java:174) ~[?:?]
> at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
> at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
> at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
> at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
> at java.lang.Thread.run(Thread.java:833) ~[?:?]
> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> ... 22 more
> 
> karaf@root()>  
> 
> 
> 
> > On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> > 
> > Hi Bert
> > 
> > Let me try to reproduce. Do you use a mail template ?
> > 
> > Regards
> > JB
> > 
> > On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> > <Be...@btc-ag.com> wrote:
> >> 
> >> Hello everyone
> >> 
> >> Maybe you have a hint for me where to look for a solution.
> >> I started to use "decanter" to send emails for error logging.
> >> 
> >> I started to use the following features:
> >>   <feature>decanter-collector-log</feature>
> >>   <feature>decanter-appender-log</feature>
> >>   <feature>decanter-alerting-email</feature>
> >> 
> >> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
> >>   rule.error="{'condition':'message:*','level':'ERROR'}"
> >> 
> >> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
> >> 
> >> But when decanter tries to send an email the following error is logged:
> >> 
> >> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> >> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> >> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> >> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> >> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> >> 
> >> 
> >> Does anyone have an idea what is missing?
> >> I am a little bit confused and could not find any source of information about this problem.
> >> 
> >> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
> >> 
> >> karaf@root()> feature:list | grep decanter | grep Started
> >> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> >> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> >> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> >> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> >> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> >> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
> >> 
> >> Thanx for any help
> >> Bert Speckels


Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

The only workaround for now is:
- downgrade to Decanter 2.9.0
- create your custom alerter

I will fix that asap in Decanter and submit a new release.

Regards
JB

On Tue, Mar 21, 2023 at 6:21 PM Speckels, Bert <Be...@btc-ag.com> wrote:
>
> Perfect Paul!
>
> Thanx alot for your work to reproduce my problem here.
>
> @Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂
>
> So currently there is no easy solution for decanter alerts using email?
>
> ________________________________
> Von: Paul Spencer <pa...@me.com>
> Gesendet: Dienstag, 21. März 2023 15:57
> An: user@karaf.apache.org <us...@karaf.apache.org>
> Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"
>
> JB,
> I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7Cb9254dbaf8534596f5db08db2a1ca655%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150074770709219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CgEsWPuxgkvLjB2MTlYEQKRxnBZ2NZOV0CIxrSeahwY%3D&reserved=0
>
> # Start karaf
> bin/karaf clean
>
> # Add decanter repo and install email alerting feature
> feature:repo-add decanter
> feature:install decanter-alerting-email
>
> # Edit etc/org.apache.karaf.decanter.alerting.email.cfg
>
> # Send an event the alerter
> event:send decanter/alert/ERROR “foo=bar”
>
> # Display the karaf.log
> log:display
>
> 10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
> 10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
> 10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
> 10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
> 10:52:25.777 INFO [features-3-thread-1] Done.
> 10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
> javax.mail.MessagingException: IOException while sending message
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
> at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
> at javax.mail.Transport.send(Transport.java:174) ~[?:?]
> at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
> at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
> at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
> at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
> at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
> at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
> at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
> at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
> at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
> at java.lang.Thread.run(Thread.java:833) ~[?:?]
> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> ... 22 more
>
> karaf@root()>
>
>
>
> > On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> >
> > Hi Bert
> >
> > Let me try to reproduce. Do you use a mail template ?
> >
> > Regards
> > JB
> >
> > On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> > <Be...@btc-ag.com> wrote:
> >>
> >> Hello everyone
> >>
> >> Maybe you have a hint for me where to look for a solution.
> >> I started to use "decanter" to send emails for error logging.
> >>
> >> I started to use the following features:
> >>   <feature>decanter-collector-log</feature>
> >>   <feature>decanter-appender-log</feature>
> >>   <feature>decanter-alerting-email</feature>
> >>
> >> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
> >>   rule.error="{'condition':'message:*','level':'ERROR'}"
> >>
> >> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
> >>
> >> But when decanter tries to send an email the following error is logged:
> >>
> >> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> >> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> >> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> >> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> >> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
> >>
> >>
> >> Does anyone have an idea what is missing?
> >> I am a little bit confused and could not find any source of information about this problem.
> >>
> >> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
> >>
> >> karaf@root()> feature:list | grep decanter | grep Started
> >> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> >> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> >> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> >> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> >> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> >> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
> >>
> >> Thanx for any help
> >> Bert Speckels
>

AW: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by "Speckels, Bert" <Be...@btc-ag.com>.
Perfect Paul!

Thanx alot for your work to reproduce my problem here.

@Jean-Baptiste: I didn't use a mail template yet. As far as I understood that's optional: I wanted to make one step after another 🙂

So currently there is no easy solution for decanter alerts using email?

________________________________
Von: Paul Spencer <pa...@me.com>
Gesendet: Dienstag, 21. März 2023 15:57
An: user@karaf.apache.org <us...@karaf.apache.org>
Betreff: Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

JB,
I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-ee4j%2Fangus-mail%2Fissues%2F87&data=05%7C01%7CBert.Speckels%40btc-ag.com%7Cb9254dbaf8534596f5db08db2a1ca655%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638150074770709219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CgEsWPuxgkvLjB2MTlYEQKRxnBZ2NZOV0CIxrSeahwY%3D&reserved=0

# Start karaf
bin/karaf clean

# Add decanter repo and install email alerting feature
feature:repo-add decanter
feature:install decanter-alerting-email

# Edit etc/org.apache.karaf.decanter.alerting.email.cfg

# Send an event the alerter
event:send decanter/alert/ERROR “foo=bar”

# Display the karaf.log
log:display

10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
10:52:25.777 INFO [features-3-thread-1] Done.
10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
javax.mail.MessagingException: IOException while sending message
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
at javax.mail.Transport.send(Transport.java:174) ~[?:?]
at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: javax.activation.UnsupportedDataTypeException: text/plain
at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
... 22 more

karaf@root()>



> On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
> Hi Bert
>
> Let me try to reproduce. Do you use a mail template ?
>
> Regards
> JB
>
> On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> <Be...@btc-ag.com> wrote:
>>
>> Hello everyone
>>
>> Maybe you have a hint for me where to look for a solution.
>> I started to use "decanter" to send emails for error logging.
>>
>> I started to use the following features:
>>   <feature>decanter-collector-log</feature>
>>   <feature>decanter-appender-log</feature>
>>   <feature>decanter-alerting-email</feature>
>>
>> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
>>   rule.error="{'condition':'message:*','level':'ERROR'}"
>>
>> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
>>
>> But when decanter tries to send an email the following error is logged:
>>
>> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
>> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
>> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
>> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
>> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
>>
>>
>> Does anyone have an idea what is missing?
>> I am a little bit confused and could not find any source of information about this problem.
>>
>> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
>>
>> karaf@root()> feature:list | grep decanter | grep Started
>> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
>> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
>> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
>> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
>> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
>> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
>>
>> Thanx for any help
>> Bert Speckels


Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Paul Spencer <pa...@me.com>.
JB,
I am using JavaMail 1.6.7 in karaf 4.3.x and used this question to test email in Karaf 4.4.3.  As a result I have reproduced this issue. In attempt to upgrade EmailAlerter to Jakarta Mail 2.1.1 with an Eclipse Angus implementation, I found a bundled dependency issue and filed the following issue https://github.com/eclipse-ee4j/angus-mail/issues/87

# Start karaf
bin/karaf clean

# Add decanter repo and install email alerting feature
feature:repo-add decanter
feature:install decanter-alerting-email

# Edit etc/org.apache.karaf.decanter.alerting.email.cfg

# Send an event the alerter
event:send decanter/alert/ERROR “foo=bar”

# Display the karaf.log 
log:display

10:52:25.772 INFO [features-3-thread-1] Registering commands for bundle org.apache.karaf.decanter.alerting.service/2.10.0
10:52:25.772 INFO [features-3-thread-1]   com.sun.mail.javax.mail/1.6.2
10:52:25.773 INFO [features-3-thread-1]   org.apache.karaf.decanter.marshaller.raw/2.10.0
10:52:25.775 INFO [features-3-thread-1]   org.apache.karaf.decanter.alerting.email/2.10.0
10:52:25.777 INFO [features-3-thread-1] Done.
10:52:48.142 ERROR [pipe-event:send decanter/alert/ERROR "foo=bar"] Can't send the alert e-mail
javax.mail.MessagingException: IOException while sending message
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) ~[?:?]
at javax.mail.Transport.send0(Transport.java:255) ~[?:?]
at javax.mail.Transport.send(Transport.java:174) ~[?:?]
at org.apache.karaf.decanter.alerting.email.EmailAlerter.handleEvent(EmailAlerter.java:140) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:432) ~[?:?]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutDenylistTiming(HandlerTask.java:82) ~[?:?]
at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:107) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventAdminImpl.sendEvent(EventAdminImpl.java:196) ~[?:?]
at org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator.sendEvent(EventAdminSecurityDecorator.java:96) ~[?:?]
at org.apache.karaf.event.command.EventSendCommand.execute(EventSendCommand.java:49) ~[?:?]
at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: javax.activation.UnsupportedDataTypeException: text/plain
at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
... 22 more

karaf@root()>  



> On Mar 21, 2023, at 6:01 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Hi Bert
> 
> Let me try to reproduce. Do you use a mail template ?
> 
> Regards
> JB
> 
> On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
> <Be...@btc-ag.com> wrote:
>> 
>> Hello everyone
>> 
>> Maybe you have a hint for me where to look for a solution.
>> I started to use "decanter" to send emails for error logging.
>> 
>> I started to use the following features:
>>   <feature>decanter-collector-log</feature>
>>   <feature>decanter-appender-log</feature>
>>   <feature>decanter-alerting-email</feature>
>> 
>> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
>>   rule.error="{'condition':'message:*','level':'ERROR'}"
>> 
>> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
>> 
>> But when decanter tries to send an email the following error is logged:
>> 
>> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
>> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
>> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
>> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
>> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
>> 
>> 
>> Does anyone have an idea what is missing?
>> I am a little bit confused and could not find any source of information about this problem.
>> 
>> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
>> 
>> karaf@root()> feature:list | grep decanter | grep Started
>> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
>> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
>> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
>> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
>> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
>> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
>> 
>> Thanx for any help
>> Bert Speckels


Re: Using Decanter log appender/collector and mail alerting fails with "javax.activation.UnsupportedDataTypeException: text/plain"

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Bert

Let me try to reproduce. Do you use a mail template ?

Regards
JB

On Sat, Mar 18, 2023 at 11:27 AM Speckels, Bert
<Be...@btc-ag.com> wrote:
>
> Hello everyone
>
> Maybe you have a hint for me where to look for a solution.
> I started to use "decanter" to send emails for error logging.
>
> I started to use the following features:
>    <feature>decanter-collector-log</feature>
>    <feature>decanter-appender-log</feature>
>    <feature>decanter-alerting-email</feature>
>
> ... configured a simple rule in "org.apache.karaf.decanter.alerting.service.cfg"
>    rule.error="{'condition':'message:*','level':'ERROR'}"
>
> ... and configured my email server in "org.apache.karaf.decanter.alerting.email.cfg"
>
> But when decanter tries to send an email the following error is logged:
>
> Caused by: javax.activation.UnsupportedDataTypeException: text/plain
> at javax.activation.DataHandler.writeTo(DataHandler.java:75) ~[org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:1.2.1_3]
> at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) ~[?:?]
> at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ~[?:?]
>
>
> Does anyone have an idea what is missing?
> I am a little bit confused and could not find any source of information about this problem.
>
> I am using karaf 4.4.3, decanter 2.10.0, camel 3.20.2
>
> karaf@root()> feature:list | grep decanter | grep Started
> decanter-common                         (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter API
> decanter-collector-log                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Messages Collector
> decanter-appender-log                   (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Log Appender
> decanter-alerting-core                  (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter Alerting core
> decanter-alerting-email-core            (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter core
> decanter-alerting-email                 (0x 2.10.0           │          │ Started     │ karaf-decanter-2.10.0             │ Karaf Decanter alerting email alerter
>
> Thanx for any help
> Bert Speckels