apache / apache/grails-core

[3.3.x and newer] Doesn't export DataSource JMX MBean

Open
#11,748 3 comments 5 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

The Grails 3.3 and newer feature a rewritten **grails-plugin-datasource** plugin which no longer creates a `dataSourceUnproxied*` bean for every `dataSource` bean. So you are left with the original proxied `dataSource` bean which holds the `TransactionAwareDataSourceProxy`. The `dataSourceUnproxied*` beans used to hold the `org.apache.tomcat.jdbc.pool.DataSource` so the underlying Tomcat JDBC Pool used to be available.

This causes the Tomcat JDBC Pool bean listing in `TomcatJDBCPoolMBeanExporter` return an empty list and no JMX MBeans are created.

I'm not sure how to approach fixing this in an elegant way.

### Task List

- [x] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)

### Steps to Reproduce

1. `grails create-app broken-jmx`
2. `gradle bootRun`
3. Check the process' exported JMX MBeans

### Expected Behaviour

A JMX MBean for each Tomcat JDBC-based `DataSource` should be exported. For example: **grails.dataSouce**

### Actual Behaviour

There is no `DataSource`-related exported JMX MBean available.

### Environment Information

- **Operating System**: Gentoo Linux
- **Grails Version:** 4.0.8
- **JDK Version:** 1.8.212

Contributor guide

Open the contributing guide

Research direction

Start with the grails-plugin-datasource behavior and the TomcatJDBCPoolMBeanExporter named in the report. Reproduce with `grails create-app broken-jmx` and `gradle bootRun`, then inspect why the exporter finds no Tomcat JDBC pools. Done means a JMX MBean is exported for each Tomcat JDBC-based DataSource.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.