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 <[email protected]> Gesendet: Dienstag, 21. März 2023 15:57 An: [email protected] <[email protected]> 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é <[email protected]> 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 > <[email protected]> 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
