Bug 1118288 - windows agent wrapper does not consider security token on starting.
Summary: windows agent wrapper does not consider security token on starting.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Agent
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: JON 3.3.0
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-10 11:44 UTC by Garik Khachikyan
Modified: 2015-01-04 22:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-01 08:28:47 UTC
Type: Bug


Attachments (Terms of Use)

Description Garik Khachikyan 2014-07-10 11:44:02 UTC
Description of problem:
Having windows agent to plug to linux RHQ server fails on `rhq-agent.wrapper.bat start` with:
===
2014-07-10 11:46:31,117 ERROR [RHQ Agent Registration Thread] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.agent-registration-rejected}The server has rejected the agent registration request. Cause: [org.rhq.core.clientapi.server.core.AgentRegistrationException:The agent asking for registration is trying to register the same address/port [10.16.23.235:16163] that is already registered under a different name [gk-winagent2]. If this new agent is actually the same as the original, then re-register with the same name and same security token. Otherwise, you should uninventory the Platform resource for agent [gk-winagent2] and re-register this new agent.]
2014-07-10 11:46:31,117 ERROR [RHQ Agent Registration Thread] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.agent-registration-retry}Will retry the agent registration request soon...
2014-07-10 11:47:01,179 ERROR [RHQ Agent Registration Thread] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.agent-registration-rejected}The server has rejected the agent registration request. Cause: [org.rhq.core.clientapi.server.core.AgentRegistrationException:The agent asking for registration is trying to register the same address/port [10.16.23.235:16163] that is already registered under a different name [gk-winagent2]. If this new agent is actually the same as the original, then re-register with the same name and same security token. Otherwise, you should uninventory the Platform resource for agent [gk-winagent2] and re-register this new agent.]
2014-07-10 11:47:01,179 ERROR [RHQ Agent Registration Thread] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.agent-registration-retry}Will retry the agent registration request soon...
2014-07-10 11:47:27,695 FATAL [WrapperSimpleAppMain] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.startup-error}The agent encountered an error during startup and must abort
org.rhq.core.clientapi.server.core.AgentRegistrationException: The agent cannot register with the server. Admin intervention needed!
	at org.rhq.enterprise.agent.AgentMain.start(AgentMain.java:710)
	at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:438)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:244)
===

Version-Release number of selected component (if applicable):
4.12.0-SNAPSHOT (1a62d13); agent md5: ea26d95717ed0041d4d03a45becc117e

How reproducible:
always on Windows machines

Steps to Reproduce:
1. prepare a windows server with java installed (and JAVA_HOME defined properly)
2. download the agent jar via: "http://server:7080/agentupdate/download"
3. java -jar <agent>.jar --install (I left to use the current C:\ directory there)
4. cd c:\rhq-agent\bin
5. rhq-agent.bat (pass the interactive steps and plug your agent to the RHQ server)
6. properly shutdown and exit through agent's console.
7. try rhq-agent-wrapper.bat install; rhq-agent-wrapper.bat start
8. follow logs: agent not starts!

Actual results:
agent fails to start using the _same_ security token which was prepared via rhq-agent.bat execution/configuration.

Expected results:
agent should reuse the security token and start normally.

Additional info:

Comment 1 Garik Khachikyan 2014-07-10 12:22:49 UTC
WORKAROUND

1. rhq-agent.bat -L (and specify the configuration again)
2. then once it loaded agent console do:
  - `config export conf/agent-configuration.xml`
  - shutdown
  - exit
3. visit RHQ server's UI and do delete the agent platform:
  - #Administration/Topology/Agents

Now when you try: the wrapper will start normally with correct configuration to your RHQ server.

trick: agent removed from server inventory list
trick: agent got configured to server (I know - just let me know if there is better way rather than manually editing that config xml) to adjust server settings

Comment 2 Jay Shaughnessy 2014-07-21 20:47:11 UTC
I think this is likely due to thew interactive agent and wrapper agent running as different users.  By default the interactive agent will run as the logged in user.  By default the wrapper agent runs as the system default user.  These users will have different Java Preferences and therefore different tokens.

Please re-run the test but this time set the RHQ_AGENT_RUN_AS_ME=true

See: 

https://docs.jboss.org/author/display/RHQ/Windows+Installation#WindowsInstallation-RunningtheAgentfromtheCommandLine


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