jboss agent javaHome

Ian Springer ian.springer at redhat.com
Fri Jan 8 23:00:47 UTC 2010


That looks fine.

As for why the default value is not being set for the Java home prop, I 
think I see why. Here's the code from the AS5 server discovery class 
that initializes that prop:

             String javaHome = 
processInfo.getEnvironmentVariable(JAVA_HOME_ENV_VAR);
             if (javaHome == null && log.isDebugEnabled()) {
                 log.debug("JAVA_HOME environment variable not set in 
JBoss AS process - defaulting "
                     + 
ApplicationServerPluginConfigurationProperties.JAVA_HOME
                     + " connection property to the plugin container JRE 
dir.");
                 javaHome = System.getenv(JAVA_HOME_ENV_VAR);
             }

             pluginConfiguration.put(new 
PropertySimple(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
                 javaHome));

So the processInfo.getEnvironmentVariable(JAVA_HOME_ENV_VAR) line would 
return null if the JBoss process is running as a different user than the 
RHQ Agent and the Agent is not running as root (because one regular user 
cannot access the environment of another user's process). And then the 
if-block which falls back to the Agent process's JAVA_HOME environment 
variable will not get executed unless the Agent happens to be running at 
DEBUG log level. So javaHome ends up being null, and there's no way for 
you to set it because that prop is not defined in the plugin descriptor.

Fyi, I've created a bug for the 'javahome' connection property not being 
defined in the descriptor:
https://bugzilla.redhat.com/show_bug.cgi?id=553808

We'll work on fixing this. In the mean time, there are a couple 
workarounds. Unfortunately, both require uninventorying your JBossAS 
Server and rediscovering/importing it...

Method A
--------
1) Uninventory the AS Server. Do this from the Browse Resources > 
Servers page.
2) Stop the Agent. Edit rhq-agent-env.sh and set RHQ_AGENT_DEBUG=true. 
Restart the Agent. This will turn on DEBUG logging. After a few minutes, 
the Agent should rediscover the AS Server and you should see it listed 
by the Auto-inventory portlet on the Dashboard.
3) Go the Dashboard and re-import the AS Server into inventory. The 
javaHome prop should now be set.

Method B
--------
(NOTE: this method requires JAVA_HOME to be set in the JBoss AS process!)
1) Uninventory the AS Server. Do this from the Browse Resources > 
Servers page.
2) Restart the Agent as root. After a few minutes, the Agent should 
rediscover the AS Server and you should see it listed by the 
Auto-inventory portlet on the Dashboard.
3) Go the Dashboard and re-import the AS Server into inventory. The 
javaHome prop should now be set as long as the JAVA_HOME env var was set 
prior to starting the AS Server.

On 01/08/2010 11:03 AM, John Holland wrote:
> CentOS 5.4   Java 1.6.0_17 HotSpot 64bit
>
> JAVA_HOME was set
>
> Thanks,
> John
>
> Ian Springer wrote:
>    
>> On 01/08/2010 10:48 AM, John Holland wrote:
>>
>>      
>>> Thanks, but it is not there. I'm looking at it now.
>>>
>>>
>>>        
>> Indeed. It looks like the javaHomePath property is missing from the
>> jboss-as-5 plugin's descriptor, which explains why you don't see it
>> listed in the connection properties. I'll create a bug for this.
>>
>> However, the java home path should default to the value of the java.home
>> System property from the Agent JVM. I'm not sure why this didn't happen
>> for you. What OS and JVM is your Agent running on? Was the JAVA_HOME
>> environment variable set prior to starting the Agent?
>>
>>
>>      
>>> Ian Springer wrote:
>>>
>>>
>>>        
>>>> On 01/07/2010 11:02 AM, John Holland wrote:
>>>>
>>>>
>>>>
>>>>          
>>>>> OK, next question: I try to restart the server and get the following - I don't see the javaHome string in the configuration for the JBoss server or for the agent, can someone tell me where it would find this?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> It should be in the JBossAS Server Resource's connection properties (go
>>>> to the Inventory>Connection tab for that Resource then click the Edit
>>>> button at the bottom of the page).
>>>>
>>>>
>>>>
>>>>          
>>>>> Thanks,
>>>>> John
>>>>>
>>>>> java.lang.RuntimeException: Start following shutdown may have failed: java.lang.IllegalStateException: The 'javaHome' connection property must be set in order to start or stop the application server via script.
>>>>>
>>>>> _______________________________________________
>>>>> rhq-devel mailing list
>>>>> rhq-devel at lists.fedorahosted.org
>>>>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> _______________________________________________
>>>> rhq-devel mailing list
>>>> rhq-devel at lists.fedorahosted.org
>>>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>>>
>>>>
>>>>
>>>>          
>>> _______________________________________________
>>> rhq-devel mailing list
>>> rhq-devel at lists.fedorahosted.org
>>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>>
>>>
>>>        
>> _______________________________________________
>> rhq-devel mailing list
>> rhq-devel at lists.fedorahosted.org
>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>
>>      
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel
>    



More information about the rhq-devel mailing list