Bug 803625 - AS7 plugin does not support jboss.server.base.dir
Summary: AS7 plugin does not support jboss.server.base.dir
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.3
Hardware: All
OS: All
high
high
Target Milestone: ---
: RHQ 4.4.0
Assignee: Libor Zoubek
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: as7-plugin
TreeView+ depends on / blocked
 
Reported: 2012-03-15 09:50 UTC by Mattias Nilsson Grip
Modified: 2015-11-02 00:42 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-08-31 10:16:21 UTC
Embargoed:


Attachments (Terms of Use)
Proposed patch 803625 (11.97 KB, patch)
2012-03-22 13:33 UTC, Mattias Nilsson Grip
no flags Details | Diff
Follow-up patch (19.53 KB, patch)
2012-03-29 09:54 UTC, Mattias Nilsson Grip
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 807008 0 unspecified CLOSED [as7] potentially non-unique Resource keys used for both standalone and domain AS7 servers 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker AS7-4271 0 None None None Never

Description Mattias Nilsson Grip 2012-03-15 09:50:14 UTC
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.

Comment 1 Heiko W. Rupp 2012-03-15 13:03:53 UTC
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?

Comment 2 Mattias Nilsson Grip 2012-03-15 13:36:46 UTC
Yes, I think I should be able to provide a patch. Will give it a try during next week.

Comment 3 Mike Foley 2012-03-19 15:34:57 UTC
per BZ triage (crouch, loleary, mfoley)

Comment 4 Mattias Nilsson Grip 2012-03-22 13:33:32 UTC
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

Comment 5 Heiko W. Rupp 2012-03-22 16:40:13 UTC
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

Comment 7 Mattias Nilsson Grip 2012-03-23 09:11:57 UTC
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

Comment 8 Heiko W. Rupp 2012-03-23 10:14:50 UTC
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

Comment 9 Mattias Nilsson Grip 2012-03-23 10:40:33 UTC
(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.

Comment 10 Heiko W. Rupp 2012-03-23 11:01:53 UTC
(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

Comment 11 Mattias Nilsson Grip 2012-03-29 09:54:26 UTC
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.

Comment 12 Libor Zoubek 2012-05-21 13:31:58 UTC
verified on JON 3.1.Beta1

Comment 13 Heiko W. Rupp 2013-08-31 10:16:21 UTC
Bulk close of old bugs in VERIFIED state.


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