Discovery | JBoss Application Server tmp Directory Deleted When JBoss Pattern Runs<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Issue When the JBoss Discovery pattern runs, the $JBOSS_HOME/standalone/tmp directory is deleted on the target host. The deletion occurs during the pattern step "match version line from standalone.bat", which executes standalone.bat -version to retrieve the JBoss application server version. Symptoms The Discovery log shows a command timeout instead of a returned version string: Executing WMI command on host: X.X.X.X, command: $JBOSS_HOME\standalone.bat" -version Command result: Command timeout after more than 60 seconds, killing remote process 1234 The $JBOSS_HOME/standalone/tmp directory is missing or emptied after the pattern runs. Discovery fails to record the JBoss version during the pattern execution. Facts Running standalone.bat --version (or standalone.bat -V) on JBoss EAP or WildFly on Windows is designed to output version information immediately and exit — it does not start the full server instance.The standalone.bat --version command does not inherently delete the tmp folder as part of its standard behavior.By default, the standalone.bat script in JBoss/WildFly does not include any tmp directory cleanup logic.It is a known practice for administrators to manually add rmdir or del commands to standalone.bat (or standalone.sh) to automate cleanup on startup, particularly in development environments. This is not recommended for production. Cause The standalone.bat script on the target host has been modified to include cleanup logic (e.g., rmdir or del commands) that deletes the $JBOSS_HOME/standalone/tmp directory. When Discovery executes standalone.bat -version during the pattern run, the modified script triggers this cleanup routine before or instead of returning version output, causing the command to time out and the tmp directory to be removed. The deletion is the result of a custom script modification or external process — it is not standard behavior of the version check command. Solution Modify the standalone.bat script on the target host so that the cleanup logic is not executed when the script is invoked with the --version (or -V) flag. The version check path should return version information and exit immediately without triggering server initialization or directory cleanup. Steps to resolve: Log in to the target Windows host running JBoss EAP or WildFly. Navigate to $JBOSS_HOME\bin\ and open standalone.bat in a text editor. Locate the section of the script that contains the rmdir or del commands responsible for deleting the standalone\tmp directory. Wrap the cleanup block in a conditional check so that it only executes when the script is not called with a version flag. The following is provided as a reference example only: REM Only perform cleanup if not running a version check echo %* | findstr /i "\-\-version \-V \-version" >nul if errorlevel 1 ( REM Place existing cleanup commands here ) ⚠️ Disclaimer: The standalone.bat script is a customer-managed file. Any modifications to this script — including the cleanup logic causing this issue — are the sole responsibility of the customer. ServiceNow does not own, maintain, or support custom code added to this file. The example above is provided for illustrative purposes only. Customers should review, test, and validate any changes to standalone.bat in accordance with their own change management policies before deploying to production. ServiceNow is not responsible for any unintended behavior resulting from modifications to customer-managed scripts. Save the modified standalone.bat file. Re-run the JBoss Discovery pattern and verify that the version is returned successfully in the Discovery log without the tmp directory being deleted. Note: If the standalone.bat modification is managed by a configuration management tool or deployment pipeline, ensure the change is propagated through the appropriate change management process to prevent it from being overwritten.