Red Hat JBoss Extended J2EE Discovery


Note

Red Hat JBoss Extended Discovery pattern supports Red Hat JBoss AS version 5 and later only

Overview

JBoss Extended Discovery is based on various configuration files. There are some differences in the approach taken that are version dependent (prior to version 7.0 or version 7.0 and later). For newer JBoss versions it involves mostly reading one (for standalone server) or two (for server in domain mode) files, whereas for older versions, as JBoss wasn't using centralized configuration file the extended discovery is based on determining deploy directories and scanning them for files describing needed resources.

This pattern relies on the core Red Hat JBoss Application Server pattern populating the 'install_root' (BASE_DIR in JBoss terminology), 'server_name' and 'mode' (for newer versions of JBoss) attributes on the SI node in order for extended discovery to take place.

Extended Discovery of JBoss AS versions 7.0 and newer

The pattern determines the approach to take by searching for the existence of 'mode' attribute on the Red Hat JBoss Application Server Software Instance that triggered it (this attribute being only set if JBoss AS 7.0 or later is discovered).

The 'mode' attribute can be set to one of two values - 'standalone' or 'domain'.

Once it has determined the approach to use is that for JBoss AS 7.0 or later, the pattern attempts to read the following configuration file:

  • <base_dir>\<mode>\configuration\<mode>.xml - (Windows)
  • <base_dir>/<mode>/configuration/<mode>.xml - (UNIX)

where <base_dir> is 'install_root' attribute of JBoss trigger Software Instance

An alternative method of obtaining configuration file :

Pattern extracts config file path from the process arguments using regex :

  • -Djboss\.server\.config\.dir=(\S+)
  • or
  • configuration=file:"?([\w:|/].+configuration)[/\\]logging

After that pattern extracts configuration file name from process arguments using regex :

  • --server-config=(\S*)

If path and name was successfully extracted pattern concatenates path and file name together .


Note: there are currently no Java Mail resources in JBoss AS 7.

Standalone mode

J2EE Applications

The pattern obtains a list of applications.

Its preferred method is to parse the configuration file with xpath /server/deployments/deployment/@name (for standalone applications) or /domain/server-groups/server-group[@name="%server_group%"]/deployments/deployment (if we know the server_name)

 If that fails it finds the directory that contains the applications by one of the following methods:

  • Parse the configuration file with //deployment-scanner/@path to find the deployment path.  Then parse the process args with -D<deployment path>=<directory that contains applications>
  • Assume the applications live at <server_base>/<deployment_name>

The list of applications is obtained from a listing of that directory. If subdirectories are found, the applications within such subdirectories are also included.


JDBC Resources

The pattern parses out the list of JDBC Resources' related JNDI names from configuration file by using the following XPath query:

  • /server/profile/subsystem/datasources/datasource/@jndi-name

For each JNDI name found the pattern looks for related URL with the help of the following Xpath query:


  • /server/profile/subsystem/datasources/datasource[@jndi-name="<jndi_name>"]/connection-url
    where <jndi_name> is current JNDI name of resource processed.


After obtaining URL the pattern parses it to obtain the database type, hostname, name and port. Based on this information the pattern creates Detail node with type 'JDBCResource' and populates it with related detabase information. The Detail key is based on found jndi name and JBoss SI's key.

Domain mode

Firstly the pattern needs to determine to which server-group the current server belongs to. In order to get this information the pattern reads host configuration file:

  • <base_dir>\domain\configuration\host.xml - for Windows platform
  • <base_dir>/domain/configuration/host.xml - for UNIX platform
    where <base_dir> is 'install_root' attribute of JBoss trigger Software Instance

Server-group is obtained from the contents of this file by using the following XPath query:


  • //server[@name="<server_name>"]/@group
    where <server_name> is 'server_name' attribute of JBoss trigger Software Instance


J2EE Applications

The pattern parses out the list of J2EE application names from configuration file by using the following XPath query:


  • /domain/server-groups/server-group[@name="<server_group>"]/deployments/deployment/@name
    where <server_group> is server-group obtained previously


For each node found the pattern creates Software Component node with type as 'J2EEApplication' and key based on found name and JBoss SI's key.

JDBC Resources

Firstly the pattern needs to get profile which is currently used by the target server by looking for it in the configuration file using the following XPath query:


  • /domain/server-groups/server-group[@name="<server_group>"]/@profile
    where <server_group> is server-group obtained previously


The pattern parses out the list of JDBC Resources' related JNDI names from configuration file by using the following XPath query:


  • /domain/profiles/profile[@name="<profile>"]/subsystem/datasources/datasource/@jndi-name
    where <profile> is value of profile obtained previously


For each JNDI name found the pattern looks for related URL using the following Xpath query:


  • /server/profile/subsystem/datasources/datasource[@jndi-name="<jndi_name>"]/connection-url
    where <jndi_name> is current JNDI name of resource processed.


After obtaining the URL the pattern parses it to obtain the database type, hostname, name and port. And basing on this the pattern creates Detail node with type 'JDBCResource' and populates it with related detabase information. The Detail key is based on found jndi name and JBoss SI's key.

JBoss AS versions prior to 7.0

Note

Extended JBoss AS discovery is supported for JBoss AS 5 or later. Earlier JBoss versions have a significantly different structure (using Apache Tomcat) which is not supported by the current patterns

Older versions of JBoss don't have centralized configuration files and the resources are deployed in the same way as applications. So initially the pattern tries to get the list of deploy directories by parsing the following file:

  • <base_dir>\server\<profile>\conf\bootstrap\profile.xml - (Windows)
  • <base_dir>/server/<profile>/conf/bootstrap/profile.xml - (UNIX)
    where <base_dir> is 'install_root' attribute of JBoss trigger Software Instance and <profile> is either 'server_name' attribute of JBoss trigger Software Instance if it exists or 'default' in other case.

Should the above fail, the DiscoverJBoss pattern attempts to read the profile.xml file at one of the following locations:

  • <server_home>/conf/bootstrap/profile.xml
  • <server_base>/<profile>/conf/bootstrap/profile.xml

where <server_home> and <server_base> are attributes of the triggering SI.

The list of deploy directories is parsed by the following XPath query:


  • //bean[@name="UserProfileFactory"]/property[@name="applicationURIs"]/list/value

Then these directories are scanned for specific files related to resources that should be modeled.

J2EE Applications

The pattern looks for files which end with ".war" or ".ear" and models each found as Software Component node with type as 'J2EEApplication' and key based on found name and JBoss SI's key.

JDBC Resources

The pattern looks for files which end with "-ds.xml" which are associated with JDBC Resources in JBoss. Each file is read and processed in order to get required information.

JNDI name of JDBC Resource is obtained from the file by using the following XPath query:

  • //jndi-name

The pattern then searches for related URL with the help of the following Xpath query:


  • /datasources/local-tx-datasource[jndi-name="<jndi_name>"]/connection-urlwhere <jndi_name> is current JNDI name of resource processed, previously found.


After obtaining URL the pattern parses it to obtain the database type, hostname, name and port. And basing on this the pattern creates Detail node with type 'JDBCResource' and populates it with related detabase information. The Detail key is based on found jndi name and JBoss SI's key.

Mail Resources

The pattern looks for files "mail-servce.xml" which are associated with Java Mail Resources in JBoss. Each file is read and processed in order to get the required information.

JNDI name of Mail Resource is obtained from the file by using the following XPath query:


  • //attribute[@name="JNDIName"]

Then the pattern searches for additional host-related information using the following Xpath queries:

  • POP3 host:

    //attribute[@name="Configuration"]/configuration/property[@name="mail.pop3.host"]/@value
  • SMTP host:

    //attribute[@name="Configuration"]/configuration/property[@name="mail.smtp.host"]/@value

Finally, the pattern creates a Detail node with type 'JavaMailResource' populates the relevant host-related attributes. The Detail key is based on found jndi name and JBoss SI's key.Go Back To Product Page

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*