JavaMail problem with sending messages by email

Problem:
[I configured postfix to send mail notifications, but javaMail does not send mail to postfix]

Expected outcome:
[I am trying to set up sending email notifications using JavaMail and postfix]

OpenNMS version: 27.2.0

Other relevant data:
/var/log/opennms/notifd.log
[2021-06-10 17:34:35,380 ERROR [NotificationTask-87] o.o.n.n.CommandExecutor: Error executing command-line binary: org.opennms.netmgt.notifd.JavaMailNotificationStrategy
java.io.IOException: Cannot run program “org.opennms.netmgt.notifd.JavaMailNotificationStrategy”: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) ~[?:?]
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:592) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:451) ~[?:?]
at org.opennms.netmgt.notifd.CommandExecutor.execute(CommandExecutor.java:115) [opennms-services-27.2.0.jar:?]
at org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274) [opennms-services-27.2.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?]
at java.lang.ProcessImpl.(ProcessImpl.java:340) ~[?:?]
at java.lang.ProcessImpl.start(ProcessImpl.java:271) ~[?:?]
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1107) ~[?:?]
… 8 more
2021-06-10 17:34:35,388 ERROR [NotificationTask-90] o.o.n.n.CommandExecutor: Error executing command-line binary: org.opennms.netmgt.notifd.JavaMailNotificationStrategy
java.io.IOException: Cannot run program “org.opennms.netmgt.notifd.JavaMailNotificationStrategy”: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1128) ~[?:?]
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:592) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:451) ~[?:?]
at org.opennms.netmgt.notifd.CommandExecutor.execute(CommandExecutor.java:115) [opennms-services-27.2.0.jar:?]
at org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274) [opennms-services-27.2.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?]
at java.lang.ProcessImpl.(ProcessImpl.java:340) ~[?:?]
at java.lang.ProcessImpl.start(ProcessImpl.java:271) ~[?:?]
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1107) ~[?:?]
… 8 more]


/usr/share/opennms/etc/javamail-configuration.properties:

# The default setting is root@[127.0.0.1]
org.opennms.core.utils.fromAddress=opennms1@example.com
org.opennms.core.utils.mailHost=127.0.0.1
org.opennms.core.utils.messageContentType=text/html

I suspect the problem is with this line - Cannot run program “org.opennms.netmgt.notifd.JavaMailNotificationStrategy”: error=2, No such file or directory

Hello @Gomering1 what is your email soltuion ??

Sorry, If I understand you correctly, here is my /etc/postfix/main.cf
file

Uncomment the next line to generate “delayed mail” warnings

#delay_warning_time = 4h

readme_directory = no

See Postfix Backwards-Compatibility Safety Net – default to 2 on

fresh installs.

compatibility_level = 2

TLS parameters

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

#smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = opennms1
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, domain.tld, openNMS, localhost.localdomain, localhost
#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

Relaying Postfix SMTP via GMAIL

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
smtp_sasl_tls_security_options = noanonymous

Hello everyone. I figured out the problem. The problem was that the configuration file was missing. I reinstalled opennms and it worked with the old setup.

1 Like