Bug 1113591 - Blank space around value of rhq.server.email.smtp-host property in rhq-server.properties is not removed and causes java.net.UnknownHostException when starting JBoss ON
Summary: Blank space around value of rhq.server.email.smtp-host property in rhq-server...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.2.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER02
: JON 3.3.0
Assignee: Libor Zoubek
QA Contact: Filip Brychta
URL:
Whiteboard:
Depends On:
Blocks: 1113593
TreeView+ depends on / blocked
 
Reported: 2014-06-26 13:23 UTC by bkramer
Modified: 2018-12-05 18:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Whitespace present in the rhq.erver.email.smtp-host property value in rhq-server.properties caused a java.net.UnknownHostException when JBoss ON was started. The fix adds a check to the rhqctl start and install commands that print warnings in case the tool finds lines with trailing spaces in rhq-server.properties file.
Clone Of:
Environment:
Last Closed: 2014-12-11 14:01:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Comment 2 bkramer 2014-06-26 14:21:18 UTC
Description of problem:
Blank space around value of rhq.server.email.smtp-host property in rhq-server.properties is not removed and causes java.net.UnknownHostException when starting JBoss ON. 

Version-Release number of selected component (if applicable):
JBoss ON 3.2.x

How reproducible:
Always

Steps to Reproduce:
1. Open $JON-SERVER/bin/rhq-server.properties file
2. Find and change the values for the mail server in something like:

    # Email settings used to connect to an SMTP server to send alert emails.
    rhq.server.email.smtp-host=my.smtp.server.com  
    rhq.server.email.smtp-port=25
    rhq.server.email.from-address=user

but make sure to have one (or more) additional blank space characters after my.smtp.server.com (to check this double-click on the value and see what is highlighted)
3. Save the change and start the JBoss ON Server.
 
Actual results:
The EAP server where JBoss ON is running is running but with errors and the following Exception is thrown during start up:

********************
16:15:47,961 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.mail-session.java:jboss/mail/Default: org.jboss.msc.service.StartException in service jboss.mail-session.java:jboss/mail/Default: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: java.lang.RuntimeException: JBAS015451: Unknown host for outbound socket binding configuration 'mail-smtp'.
        at org.jboss.as.mail.extension.MailSessionService.getServerSocketAddress(MailSessionService.java:163)
        at org.jboss.as.mail.extension.MailSessionService.setServerProps(MailSessionService.java:131)
        at org.jboss.as.mail.extension.MailSessionService.getProperties(MailSessionService.java:90)
        at org.jboss.as.mail.extension.MailSessionService.start(MailSessionService.java:64)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        ... 3 more
Caused by: java.net.UnknownHostException: my.smtp.server.com 
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) [rt.jar:1.7.0_17]
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866) [rt.jar:1.7.0_17]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) [rt.jar:1.7.0_17]
        at java.net.InetAddress.getAllByName0(InetAddress.java:1211) [rt.jar:1.7.0_17]
        at java.net.InetAddress.getAllByName(InetAddress.java:1127) [rt.jar:1.7.0_17]
        at java.net.InetAddress.getAllByName(InetAddress.java:1063) [rt.jar:1.7.0_17]
        at java.net.InetAddress.getByName(InetAddress.java:1013) [rt.jar:1.7.0_17]
        at org.jboss.as.network.OutboundSocketBinding.getDestinationAddress(OutboundSocketBinding.java:146)
        at org.jboss.as.mail.extension.MailSessionService.getServerSocketAddress(MailSessionService.java:161)
        ... 8 more
********************
and later:
********************
16:16:58,037 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/Default: org.jboss.msc.service.StartException in service jboss.mail-session.java:jboss/mail/Default: Failed to start service

16:16:58,144 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:6990/management
16:16:58,145 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015954: Admin console is not enabled
16:16:58,145 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) started (with errors) in 78391ms - Started 4934 of 5043 services (1 services failed or missing dependencies, 104 services are passive or on-demand)
********************

Expected results:
Server is started and no exception is thrown.

Additional info:

Comment 3 Libor Zoubek 2014-07-03 12:49:53 UTC
we're supplying rhq-server.properties file to underlying EAP (via -P parameter). rhq-server.properties should be a regular java properties file (see http://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html)

"White space at the beginning of the line is also ignored."

"The property value is generally terminated by the end of the line. White space following the property value is not ignored, and is treated as part of the property value."

I think this one could be closed as NOTABUG. If  you insist on fixing it anyway (which I think is not a good idea in general) we have several ways.

- fix it in EAP (to trim trailing spaces when reading property files)
- somehow cleanup property file ourself (probably in rhqctl) prior starting server

Comment 4 bkramer 2014-07-09 07:36:59 UTC
(In reply to Libor Zoubek from comment #3)
> we're supplying rhq-server.properties file to underlying EAP (via -P
> parameter). rhq-server.properties should be a regular java properties file
> (see
> http://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/
> s0204propertiesfileformat01.html)
> 
> "White space at the beginning of the line is also ignored."
> 
> "The property value is generally terminated by the end of the line. White
> space following the property value is not ignored, and is treated as part of
> the property value."
> 
> I think this one could be closed as NOTABUG. If  you insist on fixing it
> anyway (which I think is not a good idea in general) we have several ways.
> 
> - fix it in EAP (to trim trailing spaces when reading property files)
> - somehow cleanup property file ourself (probably in rhqctl) prior starting
> server

Libor, I still think that we should check the property file and remove any white space around property values. It is very easy to make this mistake but the log file and messages logged there do not show clearly where the problem is and what user should do to fix it.

Comment 5 Libor Zoubek 2014-08-18 14:01:49 UTC
in 3.3 branch

commit e84427436990ff8229e9c6c66043f19046412ad1
Author: Libor Zoubek <lzoubek>
Date:   Mon Aug 18 15:56:46 2014 +0200

    Bug 1113593 - Blank space around value of rhq.server.email.smtp-host
    property in rhq-server.properties is not removed and causes
    java.net.UnknownHostException when starting RHQ server
    
    Added a check to rhqctl start & install commands that prints warnings in
    case it finds lines with trailing spaces in rhq-server.properties file
    
    (cherry picked from commit 8b3c5958208ab48b9a7c63e90824aa43a8b76958)
    Signed-off-by: Libor Zoubek <lzoubek>

Comment 6 Simeon Pinder 2014-08-19 23:50:40 UTC
Moving to ON_QA as available to test in the following brew build:

https://brewweb.devel.redhat.com//buildinfo?buildID=379025

Comment 7 Filip Brychta 2014-09-01 15:00:24 UTC
There is no warning visible. It seems this commit didn't make it to ER01

Comment 8 Libor Zoubek 2014-09-01 15:28:30 UTC
It didn't

Comment 9 Simeon Pinder 2014-09-03 20:31:55 UTC
Moving to ON_QA as available for test with the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=381194

Comment 10 Filip Brychta 2014-09-04 11:51:19 UTC
Verified on
Version :	
3.3.0.ER02
Build Number :	
4fbb183:7da54e2

Warnings are thrown to console


Note You need to log in before you can comment on or make changes to this bug.