JBoss AS7 supports a system property jboss.server.base.dir for standalone mode that enables moving the standalone directory to a different location than $JBOSS_HOME/standalone. It also enables running several standalone instances from the same $JBOSS_HOME. See: https://docs.jboss.org/author/display/AS7/Command+line+parameters The AS7 plugin appears to use $JBOSS_HOME as the key for standalone instances. This means it will not detect a second instance launched from the same $JBOSS_HOME directory. Wouldn't it be better to use jboss.server.base.dir as key for standalone instances? Steps to Reproduce: 1. Copy $JBOSS_HOME/standalone to $JBOSS_HOME/standalone2 in AS7 install. 2. Start first instance with: $JBOSS_HOME/bin/standalone.sh 3. Start second instance with: $JBOSS_HOME/bin/standalone.sh -Djboss.server.base.dir=$JBOSS_HOME/standalone2 -Djboss.socket.binding.port-offset=100 Actual results: RHQ discovery queue will only show the first instance. Expected results: RHQ should be able to discover and import both AS7 instances.
Interesting idea - even if I am not entirely sure it was intended that way by the AS guys, but I see that this should work without the need to duplicate all the modules etc. Would you be able to provide a patch?
Yes, I think I should be able to provide a patch. Will give it a try during next week.
per BZ triage (crouch, loleary, mfoley)
Created attachment 571994 [details] Proposed patch 803625 Attaching a patch that fixes the problem in my local Linux environment. I found another thing. The discovered management port is not correct if one uses -Djboss.socket.binding.port-offset. But that setting can be changed via RHQ web interface so I can report that as a lower priority bug. Hope you find this patch useful! Regards Mattias
Matthias, thanks for the patch. It looks to me like it lacks two things - setting the base directory - log file path (that should now also be standalone2/... To see what I mean, go to the inventory tab , connection settings Could you please look into this and either send a completely new patch or a follow up to the above? Thanks Heiko
Hi Heiko, before this patch the base directory value in connection settings was populated with $JBOSS_HOME. I saw that this value is used in BaseServerComponent.startServer to prepend the path to the start script so I did not change it. It still points to $JBOSS_HOME after my patch. Is this wrong? Maybe a JBoss 7 resource should have two directory paths ("Home directory" corresponding to $JBOSS_HOME and "Base directory" corresponding to system properties jboss.server.base.dir/jboss.domain.base.dir)? The log file path was actually correctly evaluated even before my patch. In my environment it does point to standalone2/log/server.log, since it is deducted from the boot log path which is deducted from command line param -Dorg.jboss.boot.log.file (see BaseProcessDiscovery.getLogFileFromCommandLine). Does that code not work in your environment? I'm using JBoss AS 7.1.1.Final when testing. Regards, Mattias
Hi Mattias, > before this patch the base directory value in connection settings was populated > with $JBOSS_HOME. I saw that this value is used in > BaseServerComponent.startServer to prepend the path to the start script so I > did not change it. It still points to $JBOSS_HOME after my patch. Is this Have you checked that for re-starts, this also uses the -Djboss.server.base.dir found? > wrong? Maybe a JBoss 7 resource should have two directory paths ("Home > directory" corresponding to $JBOSS_HOME and "Base directory" corresponding to > system properties jboss.server.base.dir/jboss.domain.base.dir)? Yes I think this is the right solution. > The log file path was actually correctly evaluated even before my patch. In my > environment it does point to standalone2/log/server.log, since it is deducted > from the boot log path which is deducted from command line param > -Dorg.jboss.boot.log.file (see BaseProcessDiscovery.getLogFileFromCommandLine). I only specified -Djboss.server.base.dir - the server does not set the boot log file to this base dir by itself. Interestingly enough the boot.log file is written to standalone/logs/ while the server.log is written to standalone2/logs/ See https://issues.jboss.org/browse/AS7-4271 > Does that code not work in your environment? I'm using JBoss AS 7.1.1.Final > when testing. Here too. As well as (internal) eap6 beta builds
(In reply to comment #8) > Have you checked that for re-starts, this also uses the -Djboss.server.base.dir > found? I have not checked restarts actually... I will do that and adjust the patch if necessary. >> Maybe a JBoss 7 resource should have two directory paths ("Home >> directory" corresponding to $JBOSS_HOME and "Base directory" corresponding to >> system properties jboss.server.base.dir/jboss.domain.base.dir)? > > Yes I think this is the right solution. Ok to introduce this new path as part of this patch? If it is ok I can look into it. > I only specified -Djboss.server.base.dir - the server does not set the boot log > file to this > base dir by itself. Interestingly enough the boot.log file is written to > standalone/logs/ > while the server.log is written to standalone2/logs/ > > See https://issues.jboss.org/browse/AS7-4271 > Strangely, my standalone.sh script has code that sets JBOSS_LOG_DIR to $JBOSS_BASE_DIR/log and then -Dorg.jboss.boot.log.file=$JBOSS_LOG_DIR/boot.log so there seems to be some discrepancy between our AS7 versions/envs. I'll wait with adjusting this patch until AS7-4271 has been analyzed.
(In reply to comment #9) > (In reply to comment #8) > > Have you checked that for re-starts, this also uses the -Djboss.server.base.dir > > found? > I have not checked restarts actually... I will do that and adjust the patch if > necessary. Great. > > Yes I think this is the right solution. > Ok to introduce this new path as part of this patch? If it is ok I can look > into it. Yes. I don't mind if you send one or more individual .patch files. > > > I only specified -Djboss.server.base.dir - the server does not set the boot log > > file to this > > base dir by itself. Interestingly enough the boot.log file is written to > > standalone/logs/ > > while the server.log is written to standalone2/logs/ > > > > See https://issues.jboss.org/browse/AS7-4271 > > > Strangely, my standalone.sh script has code that sets JBOSS_LOG_DIR to > $JBOSS_BASE_DIR/log and then -Dorg.jboss.boot.log.file=$JBOSS_LOG_DIR/boot.log > so there seems to be some discrepancy between our AS7 versions/envs. I'll wait > with adjusting this patch until AS7-4271 has been analyzed. The script has "if $linux; then " which explains it. The magic of turning -Djboss.server.base.dir and to update the other settings is only called on Linux. Which also means it will very probably fail on Solaris or HP/UX etc. I have updated my initial description on AS7-4271 Thanks Heiko
Created attachment 573608 [details] Follow-up patch This is a follow-up patch that extends patch 0001. It fixes restarts for standalone AS7 servers that use -Djboss.server.base.dir. This patch introduces two new connection setting properties for AS7: homeDir: root directory of the JBoss installation (i.e. JBOSS_HOME) startScriptArgs: arguments that need to be passed to the start script The baseDir property is still there but now it points to jboss.server.base.dir or jboss.domain.base.dir instead of JBOSS_HOME. I verified that AS7 in domain node is still discovered and possible to restart via RHQ after this patch.
verified on JON 3.1.Beta1
Bulk close of old bugs in VERIFIED state.