MID Server ZIP installer issues when using XML Special Characters in the Password


Special Characters may cause issues during the installation of a MID Server or password change of the ServiceNow user configured on the MID Server such as showing DOWN in your instance after the Windows Service or Linux daemon is started. 

The following characters will cause issues:


The MID Server has a file named config.xml that holds the configuration parameters. One of these parameters is the user name (mid.instance.username) and password (mid.instance.password). During installation this config.xml is created and used from that point forward. If you are using a special character mentioned above you may see the following in the most recent agent.log file:

12/28/18 15:23:50 (801) WrapperStartStopAppMain Running under Java version: 1.8.0_152, java PID: 6328, args: start
12/28/18 15:23:50 (801) WrapperStartStopAppMain Initializing MID Server
12/28/18 15:23:50 (848) MIDServer Creating injector...
12/28/18 15:23:51 (082) MIDServer WARNING *** WARNING *** org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 75; The entity name must immediately follow the '&' in the entity reference.
12/28/18 15:23:51 (082) MIDServer Using configuration: C:\ServiceNowTemp\Kingstontemp\agent\config.xml
12/28/18 15:23:51 (098) MIDServer WARNING *** WARNING *** XPathUtil.selectSingleNode called with null using xpath: //parameter[@name='refresh_rate']
12/28/18 15:23:51 (098) MIDServer WARNING *** WARNING *** XPathUtil.selectSingleNode called with null using xpath: //parameter[@name='instance.date.format']
12/28/18 15:23:51 (098) MIDServer WARNING *** WARNING *** XPathUtil.selectNodes called with null using xpath: //parameter
12/28/18 15:23:51 (098) MIDServer SEVERE *** ERROR *** Unexpected exception, terminating the MID server
at com.service_now.mid.services.Config.loadParameters(Config.java:218)
at com.service_now.mid.services.Config.loadProperties(Config.java:347)
at com.service_now.mid.services.Config.init(Config.java:189)
at com.service_now.mid.MIDServer.createInjector(MIDServer.java:261)
at com.service_now.mid.MIDServer.run(MIDServer.java:196)
at com.service_now.mid.Main.runMID(Main.java:72)
at com.service_now.mid.Main.handleStart(Main.java:33)
at com.service_now.mid.Main.main(Main.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:264)
at java.lang.Thread.run(Thread.java:748)

If you are installing a MID Server for the first time, when running /agent/Installer.bat, you will see the following text in the command prompt behind the Installer window:

Dec 28, 2018 3:44:50 PM com.service_now.mid.installer.OutputHandler info
INFO: starting InstallerUI
Logger for 'glide' has not been configured by the container, configuring now:
Configuring log handler: java.util.logging.FileHandler
Setting useParentHandlers=false for Logger 'glide'
Overriding formatter to: com.glide.util.DefaultLogFormatter (for handler: java.util.logging.FileHandler)
- Required credentials not available for BASIC <any realm>@empdmosserik.service-now.com:443
- Preemptive authentication requested but no default credentials available
- basic authentication scheme selected
- Failure authenticating with BASIC 'Service-now'@empdmosserik.service-now.com:443

The screen will look like the following:

If you click "View Installer Logs" you will see:

Dec 28, 2018 3:51:00 PM com.service_now.mid.installer.OutputHandler info
INFO: InstallerUI is initialized. from here onward - gui interactions.
Dec 28, 2018 3:52:00 PM com.glide.util.GlideProperties refreshProperties
INFO: Refreshing GlideProperties from .
Dec 28, 2018 3:52:00 PM com.glide.util.GlidePropertiesLoader loadPropertyFile
INFO: Loading properties file: C:\ServiceNowTemp\KB test\agent\.\properties\glide.properties
Dec 28, 2018 3:52:01 PM com.service_now.mid.installer.OutputHandler error
SEVERE: Unable to connect to instance.
Dec 28, 2018 3:52:27 PM com.service_now.mid.installer.OutputHandler error
SEVERE: User cannot be authenticated or is missing the proper roles. If you have deleted or changed the MID server keystore, and config.xml mid.instance.password value is encrypted, you may need to change this value to plain text (during MID startup, password is re-encrypted using current keystore and written back to mid.instance.password).


You can use the following to resolve the issue:

If this is a new MID Server Installation:

Exit the installer and open /agent/config.xml. Find and edit the following lines:

<parameter name="url" value="https://YOUR_INSTANCE.service-now.com"/>
<parameter name="mid.instance.username" value="YOUR_INSTANCE_USER_NAME_HERE" />
<parameter name="mid.instance.password" value="YOUR_INSTANCE_PASSWORD_HERE" encrypt="true"/>
<parameter name="name" value="YOUR_MIDSERVER_NAME_GOES_HERE"/>

For each value, add the correct information. An example with a username of "admin" and password of "PASSWORD&" would appear like this:

<parameter name="url" value="https://myinstance.service-now.com"/>
<parameter value="admin" name="mid.instance.username"/>
<parameter value="PASSWORD&amp;" name="mid.instance.password" encrypt="true"/>
<parameter name="name" value="MID Server 1"/>

Also see PRB586201 / KB0539821MID Server won't start after new installation, password change or other config.xml edit because of SAXParseException due to using unencoded special characters that are invalid XML