Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 627712 Details for
Bug 707349
tomcat plugin: get support for Tomcat 7 fully working
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Tomcat 7 support
commit-e3d5e19 (text/plain), 35.55 KB, created by
Ken Rumer
on 2012-10-15 21:33:26 UTC
(
hide
)
Description:
Tomcat 7 support
Filename:
MIME Type:
Creator:
Ken Rumer
Created:
2012-10-15 21:33:26 UTC
Size:
35.55 KB
patch
obsolete
>commit e3d5e19fadd6c72aad195ebef4310074c093b3d2 >Author: rumer.ken <Ken.Rumer@Level3.com> >Date: Mon Oct 15 13:58:13 2012 -0600 > > Updated for Tomcat7 > >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java >index 1bb12db..e335d10 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatCacheDiscoveryComponent.java >@@ -43,16 +43,27 @@ public class TomcatCacheDiscoveryComponent extends MBeanResourceDiscoveryCompone > @Override > public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) { > >+ String objectNameTemplate = ""; >+ Set<DiscoveredResourceDetails> resources; >+ > Configuration defaultPluginConfig = discoveryContext.getDefaultPluginConfiguration(); >- String objectNameTemplate = defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue(); > String host = discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_VHOST, null); > String path = discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT, null); >+ >+ objectNameTemplate = defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue(); > objectNameTemplate = objectNameTemplate.replace("%host%", host); > objectNameTemplate = objectNameTemplate.replace("%path%", path); > defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME, objectNameTemplate)); > >- Set<DiscoveredResourceDetails> resources = super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); >+ resources = super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); > >+ if (resources.size() == 0) { >+ objectNameTemplate = getCacheObjectName(); >+ objectNameTemplate = objectNameTemplate.replace("%host%", host); >+ objectNameTemplate = objectNameTemplate.replace("%path%", path); >+ defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME, objectNameTemplate)); >+ resources = super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); >+ } > // returns only one resource. > for (DiscoveredResourceDetails detail : resources) { > Configuration pluginConfiguration = detail.getPluginConfiguration(); >@@ -63,4 +74,8 @@ public class TomcatCacheDiscoveryComponent extends MBeanResourceDiscoveryCompone > } > return resources; > } >+ >+ private String getCacheObjectName() { >+ return "Catalina:type=Cache,host=%host%,context=%path%"; >+ } > } >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >index 4013376..ab35743 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >@@ -71,10 +71,18 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > */ > public static final String PLUGIN_CONFIG_ADDRESS = "address"; > /** >+ * Plugin property name for the connector type the connector is bound to. >+ */ >+ public static final String PLUGIN_CONFIG_CONNECTOR = "connector"; >+ /** > * Plugin property name for the protocol handler. This prefix is used in the associated GlobalRequestProcessor object name. > */ > public static final String PLUGIN_CONFIG_HANDLER = "handler"; > /** >+ * Plugin property name for the name. >+ */ >+ public static final String PLUGIN_CONFIG_NAME = "name"; >+ /** > * Plugin property name for the port the connector is listening on. > */ > public static final String PLUGIN_CONFIG_PORT = "port"; >@@ -110,8 +118,8 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > @Override > public void start(ResourceContext<TomcatServerComponent<?>> context) { > if (UNKNOWN.equals(context.getPluginConfiguration().getSimple(PLUGIN_CONFIG_HANDLER).getStringValue())) { >- throw new InvalidPluginConfigurationException( >- "The connector is not listening for requests on the configured port. This is most likely due to the configured port being in use at Tomcat startup. In some cases (AJP connectors) Tomcat will assign an open port. This happens most often when there are multiple Tomcat servers running on the same platform. Check your Tomcat configuration for conflicts: " >+ throw new InvalidPluginConfigurationException( >+ "The connector is not listening for requests on the configured port. This is most likely due to the configured port being in use at Tomcat startup. In some cases (AJP connectors) Tomcat will assign an open port. This happens most often when there are multiple Tomcat servers running on the same platform. Check your Tomcat configuration for conflicts: " > + context.getResourceKey()); > } > >@@ -123,12 +131,12 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > getEmsConnection(); // reload the EMS connection > > for (MeasurementScheduleRequest request : requests) { >- String name = request.getName(); >- name = switchConnectorThreadpoolName(name); >- name = getAttributeName(name); >+ String req = request.getName(); >+ req = switchConnectorThreadpoolName(req); >+ req = getAttributeName(req); > >- String beanName = name.substring(0, name.lastIndexOf(':')); >- String attributeName = name.substring(name.lastIndexOf(':') + 1); >+ String beanName = req.substring(0, req.lastIndexOf(':')); >+ String attributeName = req.substring(req.lastIndexOf(':') + 1); > > try { > // Bean is cached by EMS, so no problem with getting the bean from the connection on each call >@@ -145,7 +153,7 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > > report.addData(new MeasurementDataNumeric(request, value.doubleValue())); > } catch (Exception e) { >- log.error("Failed to obtain measurement [" + name + "]", e); >+ log.error("Failed to obtain measurement [" + req + "]", e); > } > } > } >@@ -158,46 +166,46 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > * > * See BZ 795531. > * >- * @param name the metric property name that may need to be switched if it is a threadpool metric >+ * @param property the metric property name that may need to be switched if it is a threadpool metric > * @return the name for the metric property, switched to use the shared executor name if appropriate > */ >- private String switchConnectorThreadpoolName(String name) { >+ private String switchConnectorThreadpoolName(String property) { > Configuration pluginConfiguration = getResourceContext().getPluginConfiguration(); > String sharedExecutorName = pluginConfiguration.getSimpleValue(PLUGIN_CONFIG_SHARED_EXECUTOR, ""); > if (sharedExecutorName == null || sharedExecutorName.trim().isEmpty()) { >- return name; // there is nothing special to do if the connector isn't using a shared executor for its threadpool >+ return property; // there is nothing special to do if the connector isn't using a shared executor for its threadpool > } > >- // 1) Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy >+ // 1) Catalina:type=ThreadPool,name=%name%:currentThreadsBusy > // will be replaced with: > // Catalina:type=Executor,name=<name of shared executor>:activeCount > // >- // 2) Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount >+ // 2) Catalina:type=ThreadPool,name=%name%:currentThreadCount > // will be replaced with: > // Catalina:type=Executor,name=<name of shared executor>:poolSize > // >- // 3) Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads >+ // 3) Catalina:type=ThreadPool,name=%name%:maxThreads > // will be replaced with > // Catalina:type=Executor,name=<name of shared executor>:maxThreads >- final String NON_SHARED_THREADS_ACTIVE = "Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy"; >- final String NON_SHARED_THREADS_ALLOCATED = "Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount"; >- final String NON_SHARED_THREADS_MAX = "Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads"; >+ final String NON_SHARED_THREADS_ACTIVE = "Catalina:type=ThreadPool,name=%name%:currentThreadsBusy"; >+ final String NON_SHARED_THREADS_ALLOCATED = "Catalina:type=ThreadPool,name=%name%:currentThreadCount"; >+ final String NON_SHARED_THREADS_MAX = "Catalina:type=ThreadPool,name=%name%:maxThreads"; > final String SHARED_THREADS_ACTIVE = "Catalina:type=Executor,name=XXX:activeCount"; > final String SHARED_THREADS_ALLOCATED = "Catalina:type=Executor,name=XXX:poolSize"; > final String SHARED_THREADS_MAX = "Catalina:type=Executor,name=XXX:maxThreads"; > >- if (name.equals(NON_SHARED_THREADS_ACTIVE)) { >- name = SHARED_THREADS_ACTIVE; >- } else if (name.equals(NON_SHARED_THREADS_ALLOCATED)) { >- name = SHARED_THREADS_ALLOCATED; >- } else if (name.equals(NON_SHARED_THREADS_MAX)) { >- name = SHARED_THREADS_MAX; >+ if (property.equals(NON_SHARED_THREADS_ACTIVE)) { >+ property = SHARED_THREADS_ACTIVE; >+ } else if (property.equals(NON_SHARED_THREADS_ALLOCATED)) { >+ property = SHARED_THREADS_ALLOCATED; >+ } else if (property.equals(NON_SHARED_THREADS_MAX)) { >+ property = SHARED_THREADS_MAX; > } else { >- return name; // this isn't one of the names we need to switch, immediate return the original name as-is >+ return property; // this isn't one of the names we need to switch, immediate return the original name as-is > } > >- name = name.replace("XXX", sharedExecutorName); >- return name; >+ property = property.replace("XXX", sharedExecutorName); >+ return property; > } > > /** >@@ -218,42 +226,15 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > } > > private String getGlobalRequestProcessorName() { >- String name = "Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%"; >- >- return replaceGlobalRequestProcessorNameProps(name); >+ return replaceGlobalRequestProcessorNameProps("Catalina:type=GlobalRequestProcessor,name=%name%"); > } > >- private String replaceGlobalRequestProcessorNameProps(String name) { >- String result = name; >+ private String replaceGlobalRequestProcessorNameProps(String property) { > > Configuration pluginConfiguration = getResourceContext().getPluginConfiguration(); >- String port = pluginConfiguration.getSimple(PLUGIN_CONFIG_PORT).getStringValue(); >- String handler = pluginConfiguration.getSimple(PLUGIN_CONFIG_HANDLER).getStringValue(); >- String address = pluginConfiguration.getSimpleValue(PLUGIN_CONFIG_ADDRESS, ""); >- >- if (!"".equals(address)) { >- StringBuilder sb = new StringBuilder("-"); >- sb.append(address); >- // if it's a host name, add the IP portion that Tomcat expects >- if (!address.contains(".")) { >- String ip; >- >- try { >- ip = InetAddress.getByName(address).getHostAddress(); >- sb.append("%2F"); >- sb.append(ip); >- address = sb.toString(); >- } catch (UnknownHostException e) { >- log.debug("Failed to resolve host [" + address + "]. Can not get objectName for property: " + name); >- } >- } else { >- address = sb.toString(); >- } >- } >+ String name = pluginConfiguration.getSimple(PLUGIN_CONFIG_NAME).getStringValue(); > >- result = result.replace("%port%", port); >- result = result.replace("%address%", address); >- result = result.replace("%handler%", handler); >+ String result = property.replace("%name%", name); > > return result; > } >@@ -272,7 +253,6 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > } > } > if ((null == protocol) || protocol.toUpperCase().contains("AJP")) { >- // remove HTTP only properties > for (PropertyDefinition propDef : configDef.getPropertiesInGroup("HTTP")) { > report.getConfiguration().remove(propDef.getName()); > } >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >index 1591a5e..7a65a73 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >@@ -99,7 +99,6 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > > // Set handler plugin config and update resource name > String handler = (null != configInfo) ? configInfo.getHandler() : TomcatConnectorComponent.UNKNOWN; >- resource.setResourceName(resource.getResourceName().replace("{handler}", handler)); > > // It is unusual but possible that there is a GlobalRequestProcessor object representing a configured AJP > // connector but with a different port. If the configured AJP connector port is in use, Tomcat increments >@@ -115,6 +114,16 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > if ((null != address) && !"".equals(address.trim())) { > pluginConfiguration.put(new PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_ADDRESS, address)); > } >+ // Set connector if it is in use >+ String connector = (null != configInfo) ? configInfo.getConnector() : null; >+ if ((null != connector) && !"".equals(connector.trim())) { >+ pluginConfiguration.put(new PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_CONNECTOR, connector)); >+ } >+ >+ // Set the global request processor name (Tomcat 7 added quotes around the name value) >+ String name = (null != configInfo) ? configInfo.getName() : null; >+ resource.setResourceName(resource.getResourceName().replace("{name}", name)); >+ pluginConfiguration.put(new PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_NAME, name)); > > // Let's try to auto-discover if this Connector is using a shared executor for its thread pool. > // If it is, let's set the plugin config property automatically so we can collect the proper metrics. >@@ -122,15 +131,13 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > String connectorON = pluginConfiguration.getSimpleValue(TomcatConnectorComponent.OBJECT_NAME_PROP, null); > if (connectorON != null) { > EmsBean connectorBean = connection.getBean(connectorON); >- EmsAttribute executorNameAttrib = connectorBean.getAttribute("executorName"); // older tomcat versions won't have this attrib >- if (executorNameAttrib != null) { >- Object executorNameValue = executorNameAttrib.getValue(); >- if (executorNameValue != null) { >- String executorName = executorNameValue.toString(); >- if (!executorName.isEmpty() && !executorName.equalsIgnoreCase("Internal")) { >- pluginConfiguration.put(new PropertySimple( >- TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR, executorName)); >- } >+ EmsAttribute executorNameAttrib = connectorBean.getAttribute("executorName"); >+ Object executorNameValue = executorNameAttrib.getValue(); >+ if (executorNameValue != null) { >+ String executorName = executorNameValue.toString(); >+ if (!executorName.isEmpty() && !executorName.equalsIgnoreCase("Internal")) { >+ pluginConfiguration.put(new PropertySimple( >+ TomcatConnectorComponent.PLUGIN_CONFIG_SHARED_EXECUTOR, executorName)); > } > } > } >@@ -145,10 +152,11 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > } > > private static class ConfigInfo { >- private String name; >- private String address; >- private String handler; >- private String port; >+ private String name = ""; >+ private String address = ""; >+ private String handler = ""; >+ private String connector = ""; >+ private String port = ""; > private Exception exception; > > public ConfigInfo(EmsBean bean) { >@@ -159,30 +167,53 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > * 1) handler-port > * 2) handler-ipaddress-port > * 3) handler-host%2Fipaddress-port >+ * 4) "handler-connector-port" >+ * 5) "handler-connector-ipaddress-port" > * > * Option 2 or 3 occurs when the <address> is explicitly defined in the <connector> element. > * Option 3 occurs when the address is an alias. The alias is resolved and appended to the alias separated > * by '/' (encoded a slash comes through as %2F). Note that the host may have itself contain dashes '-'. >+ * Option 4 and 5 are Tomcat 7 > */ > > try { >- int firstDash = name.indexOf('-'); >- int lastDash = name.lastIndexOf('-'); >- handler = name.substring(0, firstDash); >- port = name.substring(lastDash + 1); >- // validate that the port is a valid int >- Integer.valueOf(port); >- >- // Check to see if an address portion exists >- if (firstDash != lastDash) { >- // For option 3 keep the alias and we'll resolve as needed >- String rawAddress = name.substring(firstDash + 1, lastDash); >- int delim = rawAddress.indexOf("%2F"); >- address = (-1 == delim) ? rawAddress : rawAddress.substring(0, delim); >+ // Check to see if this is TC7 >+ if (name.startsWith("\"")) { >+ int firstDash = name.indexOf('-'); >+ int lastDash = name.lastIndexOf('-'); >+ handler = name.substring(1, firstDash); >+ port = name.substring(lastDash + 1, name.length() - 1); >+ // validate that the port is a valid int >+ Integer.valueOf(port); >+ String middle = name.substring(firstDash + 1, lastDash); >+ >+ if (middle.indexOf('-') != -1) { >+ connector = middle.substring(0, middle.indexOf('-')); >+ address = middle.substring(middle.indexOf('-') + 1); >+ } else { >+ connector = middle; >+ } >+ } else { >+ int firstDash = name.indexOf('-'); >+ int lastDash = name.lastIndexOf('-'); >+ handler = name.substring(0, firstDash); >+ port = name.substring(lastDash + 1); >+ // validate that the port is a valid int >+ Integer.valueOf(port); >+ >+ // Check to see if an address portion exists >+ if (firstDash != lastDash) { >+ // For option 3 keep the alias and we'll resolve as needed >+ String rawAddress = name.substring(firstDash + 1, lastDash); >+ int delim = rawAddress.indexOf("%2F"); >+ address = (-1 == delim) ? rawAddress : rawAddress.substring(0, delim); >+ } > } > } catch (Exception e) { >+ name = null; > port = null; > address = null; >+ connector = null; > handler = null; > exception = e; > } >@@ -196,6 +227,10 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > return address; > } > >+ public String getConnector() { >+ return connector; >+ } >+ > public String getHandler() { > return handler; > } >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java >index 4749544..5a9b0b4 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDatasourceDiscoveryComponent.java >@@ -35,22 +35,30 @@ import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent; > public class TomcatDatasourceDiscoveryComponent extends MBeanResourceDiscoveryComponent<TomcatWarComponent> { > > @Override >- public Set<DiscoveredResourceDetails> discoverResources( >- ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) { >+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<TomcatWarComponent> discoveryContext) { >+ >+ String objectNameTemplate = ""; >+ Set<DiscoveredResourceDetails> resources; > > Configuration defaultPluginConfig = discoveryContext.getDefaultPluginConfiguration(); >- String objectNameTemplate = defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue(); >- String host = discoveryContext.getParentResourceContext().getPluginConfiguration() >- .getSimpleValue(TomcatWarComponent.PROPERTY_VHOST, null); >- String path = discoveryContext.getParentResourceContext().getPluginConfiguration() >- .getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT, null); >+ String host = discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_VHOST, null); >+ String path = discoveryContext.getParentResourceContext().getPluginConfiguration().getSimpleValue(TomcatWarComponent.PROPERTY_CONTEXT_ROOT, null); >+ >+ objectNameTemplate = defaultPluginConfig.getSimple(PROPERTY_OBJECT_NAME).getStringValue(); > objectNameTemplate = objectNameTemplate.replace("%host%", host); > objectNameTemplate = objectNameTemplate.replace("%path%", path); > defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME, objectNameTemplate)); > >- Set<DiscoveredResourceDetails> resources = super.performDiscovery(defaultPluginConfig, >- discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); >+ resources = super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); > >+ if (resources.size() == 0) { >+ objectNameTemplate = getDatasourceObjectName(); >+ objectNameTemplate = objectNameTemplate.replace("%host%", host); >+ objectNameTemplate = objectNameTemplate.replace("%path%", path); >+ defaultPluginConfig.put(new PropertySimple(PROPERTY_OBJECT_NAME, objectNameTemplate)); >+ resources = super.performDiscovery(defaultPluginConfig, discoveryContext.getParentResourceComponent(), discoveryContext.getResourceType()); >+ } >+ // returns only one resource. > for (DiscoveredResourceDetails detail : resources) { > Configuration pluginConfiguration = detail.getPluginConfiguration(); > pluginConfiguration.put(new PropertySimple(TomcatDatasourceComponent.PROPERTY_HOST, host)); >@@ -60,4 +68,8 @@ public class TomcatDatasourceDiscoveryComponent extends MBeanResourceDiscoveryCo > } > return resources; > } >+ >+ private String getDatasourceObjectName() { >+ return "Catalina:type=DataSource,context=%path%,host=%host%,class=javax.sql.DataSource,name=%name%"; >+ } > } >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java >index 542f212..0537e7e 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatDiscoveryComponent.java >@@ -55,7 +55,7 @@ import org.rhq.core.system.SystemInfo; > import org.rhq.plugins.jmx.JMXDiscoveryComponent; > > /** >- * Discovers JBoss EWS and Apache Tomcat5, Tomcat6 server instances. >+ * Discovers JBoss EWS and Apache Tomcat5, Tomcat6, Tomcat7 server instances. > * > * @author Jay Shaughnessy > */ >@@ -106,6 +106,7 @@ public class TomcatDiscoveryComponent implements ResourceDiscoveryComponent, Man > /** > * EWS RPM Install path substrings used to identify EWS tomcat version > */ >+ public static final String EWS_TOMCAT_7 = "tomcat7"; > public static final String EWS_TOMCAT_6 = "tomcat6"; > public static final String EWS_TOMCAT_5 = "tomcat5"; > >@@ -242,7 +243,7 @@ public class TomcatDiscoveryComponent implements ResourceDiscoveryComponent, Man > > if (catalinaHome == null && isWindows(context)) { > log.debug("catalina.home not found. Checking to see if this is an EWS installation."); >- // On Windows EWS uses the tomcat5.exe and tomcat6.exe executables to start tomcat. They currently do >+ // On Windows EWS uses the tomcat5.exe, tomcat6.exe or Tomcat7.exe executables to start tomcat. They currently do > // not provide the command line args that we get with the normal start up scripts that are used to > // determine catalina.home. See https://bugzilla.redhat.com/show_bug.cgi?id=580931 for more information. > // >@@ -353,8 +354,8 @@ public class TomcatDiscoveryComponent implements ResourceDiscoveryComponent, Man > return null; > } > >- //EWS supports tomcat 5 or 6 and starts them using the tomcat5.exe or >- //tomcat6.exe. The catalina homes we want for them are stored inside >+ //EWS supports tomcat 5, 6 or 7 and starts them using the tomcat5.exe, >+ //tomcat6.exe or Tomcat7.exe. The catalina homes we want for them are stored inside > //$EWS_HOME/share/tomcat-<version>, where version differs. > //EWS 1.0.1 uses tomcat 6.0.24, while EWS 1.0.2 uses tomcat 6.0.32 > >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java >index 96ae3a3..495d920 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java >@@ -146,17 +146,17 @@ public class TomcatWarComponent extends MBeanResourceComponent<TomcatVHostCompon > } > > if (null != this.webModuleMBean) { >- int state; >+ String state; > > try { > // check to see if the mbean is truly active >- state = (Integer) this.webModuleMBean.getAttribute("state").refresh(); >+ state = (String) this.webModuleMBean.getAttribute("stateName").refresh(); > } catch (Exception e) { > // if not active an exception may be thrown > state = WarMBeanState.STOPPED; > } > >- availability = (WarMBeanState.STARTED == state) ? AvailabilityType.UP : AvailabilityType.DOWN; >+ availability = (state.equals(WarMBeanState.STARTED)) ? AvailabilityType.UP : AvailabilityType.DOWN; > > if (AvailabilityType.DOWN == availability) { > // if availability is down then ensure we use a new mbean on the next try, in case we have >@@ -361,19 +361,19 @@ public class TomcatWarComponent extends MBeanResourceComponent<TomcatVHostCompon > mbeanOperation.invoke(paramValues); > > if (!WarOperation.DESTROY.equals(operation)) { >- int state = (Integer) this.webModuleMBean.getAttribute("state").refresh(); >- int expectedState = getExpectedPostExecutionState(operation); >- if (state != expectedState) { >+ String state = (String) this.webModuleMBean.getAttribute("stateName").refresh(); >+ String expectedState = getExpectedPostExecutionState(operation); >+ if (!state.equals(expectedState)) { > throw new Exception("Failed to " + name + " webapp (value of the 'state' attribute of MBean '" >- + this.webModuleMBean.getBeanName() + "' is " + state + ", not " + expectedState + ")."); >+ + this.webModuleMBean.getBeanName() + "' is \"" + state + "\", not \"" + expectedState + "\")."); > } > } > > return new OperationResult(); > } > >- private static int getExpectedPostExecutionState(WarOperation operation) { >- int expectedState; >+ private static String getExpectedPostExecutionState(WarOperation operation) { >+ String expectedState; > switch (operation) { > case START: > case RELOAD: { >@@ -446,8 +446,8 @@ public class TomcatWarComponent extends MBeanResourceComponent<TomcatVHostCompon > } > > private interface WarMBeanState { >- int STOPPED = 0; >- int STARTED = 1; >+ String STOPPED = "STOPPED"; >+ String STARTED = "STARTED"; > } > > private List<EmsBean> getVHosts() { >diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >index ce7247f..37bc478 100644 >--- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >@@ -4,7 +4,7 @@ > name="Tomcat" > displayName="Tomcat Server" > package="org.jboss.on.plugins.tomcat" >- description="Supports management and monitoring of JBoss EWS or Apache Tomcat5, Tomcat6" >+ description="Supports management and monitoring of JBoss EWS or Apache Tomcat5, Tomcat6, Tomcat7" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="urn:xmlns:rhq-plugin" > xmlns:c="urn:xmlns:rhq-configuration"> >@@ -154,13 +154,13 @@ > query="process|basename|match=^java.*,arg|org.apache.catalina.startup.Bootstrap|match=.*" /> > > <!-- >- On windows EWS uses the tomcat5.exe and tomcat6.exe executables for starting tomcat. Unlike the normal >+ On windows EWS uses the tomcat5.exe, tomcat6.exe and tomcat7.exe executables for starting tomcat. Unlike the normal > start up scripts, these do specify the command line args for determining catalina.home. See > https://bugzilla.redhat.com/show_bug.cgi?id=580931 for more details. > --> > <process-scan > name="WindowsEWSTomcat" >- query="process|basename|match=^tomcat(5|6)\.exe"/> >+ query="process|basename|match=^(T|t)omcat(5|6|7)\.exe"/> > > <operation > name="start" >@@ -751,6 +751,10 @@ > readOnly="true" > default="Catalina:type=Connector,port=%port%" /> > <c:simple-property >+ name="name" >+ type="string" >+ readOnly="true" /> >+ <c:simple-property > name="port" > type="string" > description="Port on which this connector is configured to listen." >@@ -759,7 +763,12 @@ > name="handler" > type="string" > description="Connector protocol handler." >- readOnly="true" /> >+ readOnly="true" /> >+ <c:simple-property >+ name="connector" >+ type="string" >+ description="Connector protocol connector." >+ readOnly="true" /> > <c:simple-property > name="address" > type="string" >@@ -779,7 +788,7 @@ > hiddenByDefault="true"> > <c:simple-property > name="nameTemplate" >- default="{handler}-{port}" /> >+ default="{name}" /> > <c:simple-property > name="descriptionTemplate" > default="A Tomcat connector" /> >@@ -807,42 +816,42 @@ > description="Resumes this connector" /> > > <metric >- property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:maxTime" >+ property="Catalina:type=GlobalRequestProcessor,name=%name%:maxTime" > displayName="Maximum Request Time" > description="Maximum time it took to process a request." > units="milliseconds" > category="performance" /> > > <metric >- property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:requestCount" >+ property="Catalina:type=GlobalRequestProcessor,name=%name%:requestCount" > displayName="Request count" > description="Total number of requests processed since last restart." > category="utilization" > measurementType="trendsup" /> > > <metric >- property="Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%:errorCount" >+ property="Catalina:type=GlobalRequestProcessor,name=%name%:errorCount" > displayName="Error count" > description="Number of errors while processing since last restart." > category="utilization" > measurementType="trendsup" /> > > <metric >- property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadsBusy" >+ property="Catalina:type=ThreadPool,name=%name%:currentThreadsBusy" > displayName="Threadpool Threads Active" > description="Number of current busy threads." > category="utilization" > displayType="summary" /> > > <metric >- property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:currentThreadCount" >+ property="Catalina:type=ThreadPool,name=%name%:currentThreadCount" > displayName="Threadpool Threads Allocated" > description="Number of current threads." > category="utilization" > displayType="summary" /> > > <metric >- property="Catalina:type=ThreadPool,name=%handler%%address%-%port%:maxThreads" >+ property="Catalina:type=ThreadPool,name=%name%:maxThreads" > displayName="Threadpool Max Threads" > description="Maximum number of threads that can be allocated for the ThreadPool." > category="utilization" >@@ -1270,4 +1279,4 @@ > > </server> > >-</plugin> >+</plugin> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 707349
:
500678
|
500679
|
593063
|
624151
| 627712