Is your wrapper script started as the same user as the non-daemon one?
Stuff is stored in java preferences and they are separate per user.
You are probably starting it as different users.
Configuration is stored in Java prefs on a per-user basis (see documentation re: Java Preferences API - on UNIX, it stores them at $HOME/.java.
Assuming the agent runs as root at boot time, you need to run the agent as root from the command line first to configure it fully. Running it as a different user picks up a different set of configuration.
There are other ways to preconfigure the agent, but that's the easiest. See the docs for more information on preconfiguring the agent ahead of time if that's what you want.
BTW: in /trunk, the agent will now autogenerate its agent name if you don't give it one the first time it starts up. That will be in the next release. That's specifically what that error message is telling it - agent name is stored in the user preferences, which is why one user has it set and the other user doesn't.
I don't pay attention for this...
Really I use a non root user for start JBoss and Jopr Agent and on OS boot the root user is used.
I'll change the wrapper script to force the agent start with a specific user like this:
su - <user_name> -c "java command..."
Let us know what exactly you changed and ideas to make this more configurable without having you edit the out-of-box wrapper scripts. This sounds like something alot of people will want to do (i.e. start the agent up as a specific user at boot time) but I don't know a good way to do it. We have this capability on Windows, just not on the UNIX platforms.
For example, what if you set an environment variable like "RHQ_AGENT_RUN_AS=myusername" and have the wrapper script look for that and sudo to that user if it is set?
Write a JIRA at http://jira.rhq-project.org if you think this would be a good enhancement to the launcher scripts with your ideas.
In fact, let me write the JIRA now - this is something I want to do in the future:
I hate having a capability for Windows but not for UNIX :)
Feel free to comment in that jira
Another issue when run wrapper as a non root user is that PIDFILEDIR points to /var/run that's usually not writable for non root user.
Even so agent starts with message: Failed to start - make sure the RHQ Agent is fully configured properly
Should I open a JIRA?
There is a JIRA on that already and it has been fixed in trunk