Hi Alex,
To enable remote debugging, you can start the RHQ server like this:
RHQ_SERVER_ADDITIONAL_JAVA_OPTS='-Xdebug -
Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n'
$RHQ_HOME/bin/rhq-server.sh
Cheers,
Lukas
On Thursday, July 01, 2010 11:28:38 Alexander Kiefer wrote:
Hello,
I needed to add a method to the ResourceMetadataMangerLocal interface of my
Nagios branch and implemented it in the according bean because I´m working
on the usage of dynamic metadata. The goal is to generate new ResourceTypes
at runtime.
***************************************************************************
********************************** /** Method to add a runtime-created
resourceType to an existing plugin */ public void
addNewResourceType(String newResourceTypeName) {
Plugin plugin = null;
try {
plugin =
LookupUtil.getResourceMetadataManager().getPlugin("NagiosMonitor");
} catch (NoResultException nre) {
//NoResultException is thrown if no plugin with spcific name
exists
log.error(nre);
}
log.info("Name of returned plugin: " + plugin.getName());
//Method to get the parent resource Type
//Got name and plugin from the rhq_resource_type table in the rhq
database
ResourceType parentResourceType =
LookupUtil.getResourceTypeManager().getResourceTypeByNameAndPlugin(
"NagiosMonitor", "NagiosMonitor");
log.info("Name of parent ResourceType: " +
parentResourceType.getName());
ResourceType newResourceType = new
ResourceType(newResourceTypeName, plugin.getName(),
ResourceCategory.SERVICE, parentResourceType);
log.info("Name of new ResourceType: " + newResourceType.getName());
updateType(newResourceType);
}
***************************************************************************
***********************************
As far as I can see in the log files the method seems to work correct, but
no persistence of the new ResourceType is done in the DB allthough the log
file says that the methods are called correctly (those methods that are
called within the updateType() - method).
So I need to debug the running code in the RHQ Server. I only did this with
standalone JBoss AS and not with the embedded JBoss in the RHQ server. On
standalone JBoss I would add the following line to the run.sh of the Jboss
AS. If i do this in the embedded JBoss, the server can´t be started any
more.
JAVA_OPTS="$JAVA_OPTS -Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=8787,suspend=n"
I dont want to set RHQ_SERVER_DEBUG to get additionally debug messages or
mvn -Dtest.debug to debug my unit tests. What i want is to debug my running
beans step by step from Eclipse to find out what is going wrong .How can i
handle this?
Thank you very much,
Alex