email service initiliazation failure when the jboss eap host machine boots up, jboss restart required

Latest response

Hi,

At a standalone JBoss EAP 6.4.0.GA instance, a mail session is configured as follows :
(the actual remote destination host has been replaced with "a.relay.host")

...

The host machine operates under CentOS 6.7 and the JBoss EAP is configured to run as a service
when the host starts up (using the script /bin/init.d/jboss-as-standalone.sh).

The problem is that when the host machine boots up, the mail service initialization fails.
The mail service is properly initialized if the JBoss EAP service is restarted.
Here is the error message during the mail service initialization failure:

07:36:28,748 ERROR (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "mail"),
("mail-session" => "java:jboss/mail/admin")
]) - failure description: {"JBAS014671: Failed services" => {"jboss.mail-session.java:jboss/mail/admin" => "org.jboss.msc.service.StartException in service jboss.mail-session.java:jboss/mail/admin: Failed to start service
Caused by: java.lang.RuntimeException: JBAS015451: Unknown host for outbound socket binding configuration 'admin-mail-smtp'.
Caused by: java.net.UnknownHostException: a.relay.host: unknown error"}}
07:36:28,808 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.mail-session.java:jboss/mail/admin: org.jboss.msc.service.StartException in service jboss.mail-session.java:jboss/mail/admin: Failed to start service

It is also tried to set the startup order of the JBoss EAP service script at a sufficiently large value but wihtout effect
(the default values are: chkconfig: - 80 20 ).

The above scenario can be easily reproduced and extended if the JBoss EAP is started without network connection and the
connection is established again later. Here are the scenario's steps:

  • Disconnect the network

  • Start JBoss EAP , mail service initialization error as above

  • Reconnect the network

  • Trigger a EJB component initilization that uses email service, EJB component instance construction fails with the following error:

Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:164) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
...
Caused by: javax.ejb.EJBException: java.lang.RuntimeException: Error looking up java:jboss/mail/admin in JNDI
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:191) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
...
Caused by: java.lang.RuntimeException: Error looking up java:jboss/mail/admin in JNDI
at org.jboss.weld.injection.spi.helpers.AbstractResourceServices.resolveResource(AbstractResourceServices.java:51) [weld-spi-1.1.0.Final-redhat-6.jar:20150114-0319]
...
Caused by: javax.naming.NamingException [Root exception is java.lang.NullPointerException]
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:142)
...
Caused by: java.lang.NullPointerException
at javax.mail.Session.(Session.java:206) [mail-1.4.5.redhat-2.jar:1.4.5.redhat-2]
at javax.mail.Session.getInstance(Session.java:241) [mail-1.4.5.redhat-2.jar:1.4.5.redhat-2]

Although the network connection is established, no attempt to re-initialize the mail service is performed.

Thanks in advanced,

John Psoroulas

Responses

Mail session configuration

<mail-session debug="true" jndi-name="java:jboss/mail/admin">
    <custom-server name="smtp" outbound-socket-binding-ref="admin-mail-smtp">
        <property name="mail.smtp.connectiontimeout" value="5000" />
    </custom-server>
</mail-session>
...
<outbound-socket-binding name="admin-mail-smtp">
    <remote-destination host="a.relay.host" port="25" />
</outbound-socket-binding>
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.