Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 573608 Details for
Bug 803625
AS7 plugin does not support jboss.server.base.dir
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Follow-up patch
0002-803625-fix-restarts-when-Djboss.server.base.dir-is-u.patch (text/plain), 19.53 KB, created by
Mattias Nilsson Grip
on 2012-03-29 09:54:26 UTC
(
hide
)
Description:
Follow-up patch
Filename:
MIME Type:
Creator:
Mattias Nilsson Grip
Created:
2012-03-29 09:54:26 UTC
Size:
19.53 KB
patch
obsolete
>From e1bb5f1b632ad28ce8c2996d90bf720fcf240ade Mon Sep 17 00:00:00 2001 >From: Mattias Nilsson Grip <mattias.nilsson.grip@redpill-linpro.com> >Date: Thu, 29 Mar 2012 11:36:18 +0200 >Subject: [PATCH 2/2] 803625 fix restarts when -Djboss.server.base.dir is used > >--- > .../org/rhq/modules/plugins/jbossas7/AS7Mode.java | 12 ++-- > .../plugins/jbossas7/AbstractBaseDiscovery.java | 51 +++++++++++++++----- > .../plugins/jbossas7/BaseProcessDiscovery.java | 34 +++++-------- > .../plugins/jbossas7/BaseServerComponent.java | 18 +++++-- > .../src/main/resources/META-INF/rhq-plugin.xml | 8 ++- > 5 files changed, 74 insertions(+), 49 deletions(-) > >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7Mode.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7Mode.java >index a98e13c..a353518 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7Mode.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AS7Mode.java >@@ -29,14 +29,14 @@ public enum AS7Mode { > HOST("host.xml", "domain", "--host-config", "bin/domain.sh","hostConfig"); > > private String defaultXmlFile; >- private String baseDir; >+ private String defaultBaseDir; > private String configArg; > private String startScript; > private String configPropertyName; > >- private AS7Mode(String defaultXmlFile, String baseDir, String configArg, String startScript, String configPropertyName) { >+ private AS7Mode(String defaultXmlFile, String defaultBaseDir, String configArg, String startScript, String configPropertyName) { > this.defaultXmlFile = defaultXmlFile; >- this.baseDir = baseDir; >+ this.defaultBaseDir = defaultBaseDir; > this.configArg = configArg; > this.startScript = startScript; > this.configPropertyName = configPropertyName; >@@ -46,8 +46,8 @@ public enum AS7Mode { > return defaultXmlFile; > } > >- public String getBaseDir() { >- return baseDir; >+ public String getDefaultBaseDir() { >+ return defaultBaseDir; > } > > public String getConfigArg() { >@@ -61,4 +61,4 @@ public enum AS7Mode { > public String getConfigPropertyName() { > return configPropertyName; > } >-} >\ No newline at end of file >+} >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >index 1a4044e..3db9d07 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java >@@ -45,7 +45,10 @@ public class AbstractBaseDiscovery { > static final String DORG_JBOSS_BOOT_LOG_FILE = "-Dorg.jboss.boot.log.file="; > private static final String DJBOSS_SERVER_HOME_DIR = "-Djboss.home.dir"; > private static final String DJBOSS_SERVER_BASE_DIR = "-Djboss.server.base.dir"; >+ private static final String DJBOSS_DOMAIN_BASE_DIR = "-Djboss.domain.base.dir"; > private static final String DJBOSS_SERVER_CONFIG_DIR = "-Djboss.server.config.dir"; >+ private static final String DJBOSS_DOMAIN_CONFIG_DIR = "-Djboss.domain.config.dir"; >+ private static final String DJBOSS_SOCKET_BIND_OFFSET = "-Djboss.socket.binding.port-offset"; > static final int DEFAULT_MGMT_PORT = 9990; > private static final String JBOSS_AS_PREFIX = "jboss-as-"; > static final String CALL_READ_STANDALONE_OR_HOST_XML_FIRST = "hostXml is null. You need to call 'readStandaloneOrHostXml' first."; >@@ -110,12 +113,14 @@ public class AbstractBaseDiscovery { > * @param commandLine command line arguments of the process > * @return The base dir if found or empty string otherwise > */ >- String getBaseDirFromCommandLine(String[] commandLine) { >+ String getBaseDirFromCommandLine(String[] commandLine, String homeDir, AS7Mode mode) { > for (String line : commandLine) { > if (line.startsWith(DJBOSS_SERVER_BASE_DIR)) > return line.substring(DJBOSS_SERVER_BASE_DIR.length() + 1); >+ if (line.startsWith(DJBOSS_DOMAIN_BASE_DIR)) >+ return line.substring(DJBOSS_DOMAIN_BASE_DIR.length() + 1); > } >- return ""; >+ return homeDir + File.separator + mode.getDefaultBaseDir(); > } > > /** >@@ -128,6 +133,8 @@ public class AbstractBaseDiscovery { > for (String line : commandLine) { > if (line.startsWith(DJBOSS_SERVER_CONFIG_DIR)) > return line.substring(DJBOSS_SERVER_CONFIG_DIR.length() + 1); >+ if (line.startsWith(DJBOSS_DOMAIN_CONFIG_DIR)) >+ return line.substring(DJBOSS_DOMAIN_CONFIG_DIR.length() + 1); > } > return ""; > } >@@ -169,6 +176,23 @@ public class AbstractBaseDiscovery { > } > > /** >+ * Determine the parameters that need to be passed as >+ * arguments to the start script when starting this instance. >+ * >+ * @param commandLine command line arguments of the process >+ * @return start script arguments separated by spaces if found or empty string otherwise >+ */ >+ String getStartScriptArgumentsFromCommandLine(String[] commandLine) { >+ String args = ""; >+ for (String line : commandLine) { >+ if (line.startsWith(DJBOSS_SERVER_BASE_DIR) || line.startsWith(DJBOSS_DOMAIN_BASE_DIR) >+ || line.startsWith(DJBOSS_SOCKET_BIND_OFFSET)) >+ args += " " + line; >+ } >+ return args; >+ } >+ >+ /** > * Try to obtain the management IP and port from the already parsed host.xml or standalone.xml > * @return an Object containing host and port > * @see #readStandaloneOrHostXml(org.rhq.core.system.ProcessInfo, boolean) on how to obtain the parsed xml >@@ -361,8 +385,7 @@ public class AbstractBaseDiscovery { > > String fullName; > if (relDir.equals("jboss." + dmode + ".config.dir")) >- fullName = baseDir + File.separator + mode.getBaseDir() + File.separator + "configuration" + File.separator >- + fileName; >+ fullName = baseDir + File.separator + "configuration" + File.separator + fileName; > else > fullName = relDir + File.separator + fileName; > >@@ -383,18 +406,20 @@ public class AbstractBaseDiscovery { > if (!configDir.isEmpty()) { > builder = new StringBuilder(configDir); > } else { >- String baseDir = getBaseDirFromCommandLine(commandLine); >+ AS7Mode mode; >+ if (isDomain) >+ mode = AS7Mode.DOMAIN; >+ else >+ mode = AS7Mode.STANDALONE; >+ String homeDir = processInfo.getEnvironmentVariable("jboss.home.dir"); >+ if (homeDir == null) >+ homeDir = getHomeDirFromCommandLine(commandLine); >+ String baseDir = getBaseDirFromCommandLine(commandLine, homeDir, mode); > if (!baseDir.isEmpty()) { > builder = new StringBuilder(baseDir); > } else { >- String home = processInfo.getEnvironmentVariable("jboss.home.dir"); >- if (home == null) >- home = getHomeDirFromCommandLine(commandLine); >- builder = new StringBuilder(home); >- if (isDomain) >- builder.append(File.separator).append(AS7Mode.DOMAIN.getBaseDir()); >- else >- builder.append(File.separator).append(AS7Mode.STANDALONE.getBaseDir()); >+ builder = new StringBuilder(homeDir); >+ builder.append(File.separator).append(mode.getDefaultBaseDir()); > } > builder.append(File.separator).append("configuration"); > } >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >index 9b93fb2..5416236 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java >@@ -121,8 +121,12 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > > } > >- config.put(new PropertySimple("baseDir", homeDir)); >+ config.put(new PropertySimple("homeDir", homeDir)); >+ String baseDir = getBaseDirFromCommandLine(commandLine, homeDir, AS7Mode.DOMAIN); >+ config.put(new PropertySimple("baseDir", baseDir)); > config.put(new PropertySimple("startScript", AS7Mode.DOMAIN.getStartScript())); >+ config.put(new PropertySimple("startScriptArgs", >+ getStartScriptArgumentsFromCommandLine(commandLine))); > String host = findHost(psr.getProcessInfo(), true); > config.put(new PropertySimple("domainHost", host)); > >@@ -143,6 +147,7 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > description = "Standalone " + AS7 + " server"; > > readStandaloneOrHostXml(psr.getProcessInfo(), false); >+ String baseDir = getBaseDirFromCommandLine(commandLine, homeDir, AS7Mode.STANDALONE); > if (homeDir.isEmpty()) { > // Will this code ever run? /Mattias > // Try to obtain the server name >@@ -155,22 +160,14 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > tmp = tmp.substring(0, tmp.indexOf(File.separator)); > serverNameFull = tmp; > } else { >- // determine serverNameFull from jboss.server.base.dir system property on command line >- String baseDir = getBaseDirFromCommandLine(commandLine); >- if (!baseDir.isEmpty()) { >- serverNameFull = baseDir; >- } else { >- // determine serverNameFull from standalone.xml location >- String standaloneXmlFileLocation = getHostXmlFileLocation(psr.getProcessInfo(), false); >- serverNameFull = standaloneXmlFileLocation.substring(0, >- standaloneXmlFileLocation.lastIndexOf(File.separator + "configuration")); >- } >+ serverNameFull = baseDir; > } > > String host = findHost(psr.getProcessInfo(), false); > config.put(new PropertySimple("domainHost", host)); > >- config.put(new PropertySimple("baseDir", homeDir)); >+ config.put(new PropertySimple("homeDir", homeDir)); >+ config.put(new PropertySimple("baseDir", baseDir)); > > serverName = findHostName(); > if (serverName.isEmpty()) >@@ -179,8 +176,10 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > String serverConfig = getServerConfigFromCommandLine(commandLine, AS7Mode.STANDALONE); > config.put(new PropertySimple("config", serverConfig)); > config.put(new PropertySimple("startScript", AS7Mode.STANDALONE.getStartScript())); >+ config.put(new PropertySimple("startScriptArgs", >+ getStartScriptArgumentsFromCommandLine(commandLine))); > >- fillUserPassFromFile(config, AS7Mode.STANDALONE, serverNameFull); >+ fillUserPassFromFile(config, AS7Mode.STANDALONE, baseDir); > > //preload server.log file for event log monitoring > logFile = bootLogFile.substring(0, bootLogFile.lastIndexOf(File.separator)) + File.separator >@@ -381,15 +380,6 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery implements Resou > //-Dorg.jboss.boot.log.file=/devel/jbas7/jboss-as/build/target/jboss-7.0.0.Alpha2/domain/log/server-manager/boot.log > //-Dlogging.configuration=file:/devel/jbas7/jboss-as/build/target/jboss-7.0.0.Alpha2/domain/configuration/logging.properties > >- String getLogFileFromCommandLine(String[] commandLine) { >- >- for (String line : commandLine) { >- if (line.startsWith(DORG_JBOSS_BOOT_LOG_FILE)) >- return line.substring(DORG_JBOSS_BOOT_LOG_FILE.length()); >- } >- return ""; >- } >- > private void initLogEventSourcesConfigProp(String fileName, Configuration pluginConfiguration) { > > PropertyList logEventSources = pluginConfiguration >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >index c003e2b..1261573 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >@@ -106,12 +106,13 @@ public class BaseServerComponent extends BaseComponent implements MeasurementFac > protected OperationResult startServer(AS7Mode mode) { > OperationResult operationResult = new OperationResult(); > String startScript = pluginConfiguration.getSimpleValue("startScript", mode.getStartScript()); >- String baseDir = pluginConfiguration.getSimpleValue("baseDir",""); >- if (baseDir.isEmpty()) { >- operationResult.setErrorMessage("No base directory provided"); >+ String startScriptArgs = pluginConfiguration.getSimpleValue("startScriptArgs", ""); >+ String homeDir = pluginConfiguration.getSimpleValue("homeDir", ""); >+ if (homeDir.isEmpty()) { >+ operationResult.setErrorMessage("No home directory provided"); > return operationResult; > } >- String script = baseDir + File.separator + startScript; >+ String script = homeDir + File.separator + startScript; > > ProcessExecution processExecution; > processExecution = ProcessExecutionUtility.createProcessExecution(new File("/bin/sh")); >@@ -124,6 +125,11 @@ public class BaseServerComponent extends BaseComponent implements MeasurementFac > } > > arguments.add(script); >+ // split the start script args by spaces and add them individually >+ if (!startScriptArgs.isEmpty()) { >+ for (String arg : startScriptArgs.split("\\s+")) >+ arguments.add(arg); >+ } > > if (!config.equals(mode.getDefaultXmlFile())) { > arguments.add(mode.getConfigArg()); >@@ -138,7 +144,7 @@ public class BaseServerComponent extends BaseComponent implements MeasurementFac > > } > } >- processExecution.setWorkingDirectory(baseDir); >+ processExecution.setWorkingDirectory(homeDir); > processExecution.setCaptureOutput(true); > processExecution.setWaitForCompletion(15000L); // 15 seconds // TODO: Should we wait longer than 15 seconds? > processExecution.setKillOnTimeout(false); >@@ -246,7 +252,7 @@ public class BaseServerComponent extends BaseComponent implements MeasurementFac > } > String standaloneXmlFile = pluginConfig.getSimpleValue("config",mode.getDefaultXmlFile()); > >- String standaloneXml = baseDir + File.separator + mode.getBaseDir() + File.separator + "configuration" + File.separator + standaloneXmlFile; >+ String standaloneXml = baseDir + File.separator + "configuration" + File.separator + standaloneXmlFile; > > AbstractBaseDiscovery abd = new AbstractBaseDiscovery(); > abd.readStandaloneOrHostXmlFromFile(standaloneXml); >diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >index 7dfeb48..528e429 100644 >--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >@@ -68,8 +68,10 @@ > <c:simple-property name="password" type="password" default="rhqadmin" description="Password for the management user" required="false"/> > <c:simple-property name="domainConfig" type="string" default="domain.xml" description="Running configuration (domain part)" displayName="Domain Configuration"/> > <c:simple-property name="hostConfig" type="string" default="host.xml" description="Running configuration (host part)" displayName="Host Configuration"/> >- <c:simple-property name="baseDir" type="file" description="Base directory of the server installation" displayName="Base directory" readOnly="true" required="false"/> >+ <c:simple-property name="homeDir" type="file" description="Root directory of the server installation" displayName="Home directory" readOnly="true" required="false"/> >+ <c:simple-property name="baseDir" type="file" description="Base directory for domain content" displayName="Base directory" readOnly="true" required="false"/> > <c:simple-property name="startScript" type="file" default="bin/domain.sh" description="Script used to start the server. If the path is not absolute, it is relative to the base directory"/> >+ <c:simple-property name="startScriptArgs" type="string" default="" description="Any required arguments to the start script" displayName="Start script arguments" required="false" /> > <c:simple-property name="javaHomePath" type="file" displayName="JAVA_HOME Path" required="false" > description="The absolute path to a JRE or JDK installation directory containing > the JVM that should be used to start and shutdown the HostController instance; >@@ -367,8 +369,10 @@ > <c:simple-property name="user" default="rhqadmin" type="string" description="Management user for a secured AS" required="false"/> > <c:simple-property name="password" default="rhqadmin" type="password" description="Password for the management user" required="false"/> > <c:simple-property name="config" type="string" default="standalone.xml" description="Running configuration" displayName="Configuration"/> >- <c:simple-property name="baseDir" type="file" description="Base directory of the server installation" displayName="Base directory" readOnly="true" required="false"/> >+ <c:simple-property name="homeDir" type="file" description="Root directory of the server installation" displayName="Home directory" readOnly="true" required="false"/> >+ <c:simple-property name="baseDir" type="file" description="Base directory for server content" displayName="Base directory" readOnly="true" required="false"/> > <c:simple-property name="startScript" type="file" default="bin/standalone.sh" description="Script used to start the server. If the path is not absolute, it is relative to the base directory"/> >+ <c:simple-property name="startScriptArgs" type="string" default="" description="Any required arguments to the start script" displayName="Start script arguments" required="false" /> > <c:simple-property name="javaHomePath" type="file" displayName="JAVA_HOME Path" required="false" > description="The absolute path to a JRE or JDK installation directory containing > the JVM that should be used to start and shutdown the JBossAS instance; >-- >1.7.5.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 803625
:
571994
| 573608