Bug 1201269 - Tomcat 7 datasources are not discovered if defined in server.xml file
Summary: Tomcat 7 datasources are not discovered if defined in server.xml file
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin
Version: 2.1.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: post-GA
: 3.0.0
Assignee: Jean-frederic Clere
QA Contact: Jan Stefl
URL:
Whiteboard:
Depends On:
Blocks: 1201273 1229834 1290529
TreeView+ depends on / blocked
 
Reported: 2015-03-12 12:41 UTC by bkramer
Modified: 2019-08-15 04:21 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
This release of JBoss Web Server carries a bug that prevents Tomcat 7 datasources from being discovered if they are defined in the `server.xml` file. A workaround to this issue is to define the datasources in the `context.xml` file.
Clone Of:
: 1229834 (view as bug list)
Environment:
Last Closed: 2019-06-13 12:09:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JWS-838 0 Major Verified Tomcat 7 datasources are not discovered if defined in server.xml file 2018-03-01 14:41:17 UTC
Red Hat Knowledge Base (Solution) 1378693 0 None None None Never

Description bkramer 2015-03-12 12:41:37 UTC
Description of problem:
Tomcat 7 datasources are not discovered if defined in server.xml file. At the same time, datasources will be properly discovered when defined in the context.xml file.

It seems that the problem is in the name of the MBean that tomcat plugin expects to see:

- if datasource is defined using server.xml file, the MBean name will be: Catalina:type=DataSource,class=javax.sql.DataSource,name="jdbc/mysql";

- if datasource is defined using context.xml file, the MBean name is: Catalina:type=DataSource,context=/examples,host=localhost,class=javax.sql.DataSource,name="jdbc/mysql"

Version-Release number of selected component (if applicable):
- JBoss ON 3.2
- Red Hat JBoss Web Server 2.1.0 
- Web Server Plugin Pack for Red Hat JBoss Operations Network 3.2.0 (the same result is when plugin is updated with: Web Server Plugin Pack Update-01 for JBoss ON 3.2)

How reproducible:
Always

Steps to Reproduce:
1. Install and start JBoss ON 3.2
2. Download, install  and configure EWS 2.1.0 and Tomcat 7; 
3. Install JBoss ON plugin for EWS;
3. Define datasource in the context.xml file - for instance add the following Resource inside Context:

***********************
...
<Context>
...
    <Resource auth="Container"
              name="jdbc/mysql"
              type="javax.sql.DataSource"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/test"
              username="userName" password="password" />
</Context>
***********************
4. Save the file, restart the Tomcat;
5. Navigate to the JBoss ON UI -> Tomcat Servers -> Tomcat instance -> Tomcat Virtual Hosts -> localhost -> Tomcat Web Application (WAR)s -> example and there should be Tomcat Datasoruces with the "jdbc/mysql" discovered;
6. Shutdown Tomcat instance and uninventory it from the JBoss ON UI;
7. Delete Resource configuration (given in the step 3 above) from context.xml and instead add the following in the context.xml file:
***********************
<Context>
...
<ResourceLink name="jdbc/mysql" 
              global="jdbc/mysql"
              auth="Container"
              type="javax.sql.DataSource" />
</Context>
***********************
   
Above Resource configuration add to the Tomcat's server.xml file:

***********************
<GlobalNamingResources>
...
    <Resource auth="Container"
              name="jdbc/mysql"
              type="javax.sql.DataSource"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/test"
              username="userName" password="password" />
</GlobalNamingResources>
***********************
and save the file.
8. Start Tomcat server again and let JBoss ON Agent discover it;

Actual results:
No datasource is discovered

Expected results:
Globally defined datasources should be discovered.


Additional info:

Comment 1 bkramer 2015-03-19 13:30:13 UTC
Tested using both JON 3.2 and JON 3.3 (with the appropriate plugins) and the issue exists - globally defined datasources cannot be discovered.

Comment 4 Beck Maxime 2015-04-29 13:19:03 UTC
Fix is in pull request : https://github.com/rhq-project/rhq/pull/167

Comment 10 fgoldefu 2015-09-11 10:23:47 UTC
Waiting for attachment update of plugin pack Bug 1205676.

Comment 11 Larry O'Leary 2017-11-02 13:10:13 UTC
Moving to MODIFIED as this was fixed a very long time ago and just needed to be tested. I am hoping that it gets tested in update 02 of the JWS plug-in pack update for JBoss ON 3.3.

Comment 13 Jan Onderka 2018-01-17 15:56:32 UTC
Verified with newest JWS SP2 DR1 build.


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