Hello, i want Axon Ivy to send an Email when there is an error so i added this code to "log4jconfig.xml":

< appender name="EmailAppender" class="org.apache.log4j.net.SMTPAppender">
        < param name="BufferSize" value="512" / >
        < param name="SMTPHost" value="smtp.gmail.com" / > 
        < param name="SMTPProtocol" value="smtps" / >
        < param name="SMTPPort" value="465" / >
        < param name="SMTPUsername" value=" *** " / >
        < param name="SMTPPassword" value=" *** " / >
        < param name="From" value=" *** " / >
        < param name="To" value=" *** " / >
        < param name="Subject" value="Testing Log4j Mail Notification" / >
        < layout class="org.apache.log4j.PatternLayout">
            < param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n" / >
        < /layout >
    < /appender >

  < root > 
    < level value ="WARN" / > 
    < appender-ref ref="FileLog"/ > 
    < appender-ref ref="EmailAppender"/ >
    < appender-ref ref="ConsoleAppender"/ >    
    < /root >

The FileLog works but i dont receive the email. When i change the order to this:

< appender-ref ref="EmailAppender"/ >
< appender-ref ref="FileLog"/ >

then the FileLog and the MailAppender doesn't work.
When i use the same code in an Eclipse Java Project it works and i get the email.

What should i do?

Edit: Do i have to add mail.jar and activation.jar to my build path in Axon Ivy? In Eclipse i added them to lib and it worked but i don't know how to integrate them to Axon Ivy.

Edit2: With Log4j debug=true i get this Error in my logfile:
2019-01-22 16:21:32.230 ERROR [ch.ivyteam.log.LoggerFactory] [main] [] Log4j: Could not configure java.lang.NoClassDefFoundError: javax/mail/internet/AddressException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) at java.lang.Class.getConstructor0(Class.java:3075) at java.lang.Class.newInstance(Class.java:412) at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:247) at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
...

asked 03.01 at 05:05

karstenk's gravatar image

karstenk
11113
accept rate: 0%

edited 22.01 at 10:28

May be you defined the appender at the wrong location in the log4jconfig.xml? All Appenders must be together!

(08.01 at 10:25) Christian St... ♦ Christian%20Strebel's gravatar image

Thanks for your answer but all Appenders are together.

(11.01 at 05:49) karstenk karstenk's gravatar image

The log appender must be made compatible with our OSGi java runtime environment.

This means that you have to enrich the JAR that supplies the appender with dependencies to our log infrastructure and register it as buddy of our commons.lib bundle.

A full blown example is accessible here: https://github.com/ivy-samples/ivy-extension-demos/tree/master/CustomLogAppender

link

answered 22.01 at 04:37

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.0k11550
accept rate: 68%

The SMTP Appender i want to use is a default Appender from Log4j (like the Console Appender). I don't want to build a custom Appender. Is it necessary to build a custom Appender to use the SMTP Appender?

(22.01 at 08:55) karstenk karstenk's gravatar image

Ok I see. The access from the STMPAppender to javax.mail.internet.AddressException is blocked by the default ivy bundle configuration. You could fix it with a work-around: open the plugins/ch.ivyteam.util_XYZ.jar and add an additional header to to the META-INF/Manifest.MF within it. Eclipse-RegisterBuddy: commons.lib If you can need a bulletproof solution please share the Designer version which you are using.

(29.01 at 03:07) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

I have Version 7.2.1. I don't have the folder util in my project explorer like in the screenshot. And when I open the file with the Plugins View, I can't edit the Manifest.mf.

(29.01 at 14:58) karstenk karstenk's gravatar image

Ok thanks for the version info. My screenshot should just serves as an example on what to write into the Manifest.MF (and focuses to 7.0 users). But the procedure for 7.2.1 is different: Open the system/plugins/ch.ivyteam.lib.util_7.2.1-XYZ/META-INF/MANIFEST.MF. Add the line marked in my screenshot. Run the engine again and see whether the NoClassDefFound errors are gone.

(30.01 at 02:44) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

I changed the File in Axon Ivy\plugins\ch.ivyteam.lib.util_7.2.0.201810151000\META-INF\MANIFEST.MF The File looks ends like this: ... Created-By: Apache Maven 3.5.2 Build-Jdk: 1.8.0_151 Eclipse-BundleShape: dir Eclipse-RegisterBuddy: commons.lib

I still get the same error.

(05.02 at 05:21) karstenk karstenk's gravatar image

You can try the following:

  1. Open the file /system/plugins/ch.ivyteam.util_*.jar with a ZIP program and extract the file /lib/mvn/javax.mail-1.5.6.jar
  2. Copy the extracted file to the directory /jre/lib/ext
  3. Restart the engine
link

answered 20.03 at 05:40

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.9k172654
accept rate: 74%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×30
×24
×6
×5

Asked: 03.01 at 05:05

Seen: 569 times

Last updated: 20.03 at 05:40