Grafana and JMX_Exporter data source issue

I am new to Grafana. I am trying to setup monitoring and dashboard for java based Apache AMQ message broker. I have setup the jmx exporter configuration on the AMQ broker side and exposed the metrics via port 9161.
ACTIVEMQ_OPTS="-javaagent:%ARTEMIS_INSTANCE%\lib\jmx_prometheus_javaagent-0.12.0.jar=9161:%ARTEMIS_INSTANCE%\lib\promconfig.yml"

On Grafana side i configured the datasource using the url as http://localhost:9161 and Access as ‘Server’ mode and HTTP method as GET.

SAVE and TEST -> doesnt give the message “Data Source is working”

  1. When i access the url in browser, i can see the exposed jvm and amq artemis exposed metrics.

  2. When i use the query inspector, it returns the complete metrics page http://localhost:9161 as response instead of the metrics value.

I tried downgrading Grafana version, didnt work.

I enabled debug logging, but nothing is reported as error.

I enabled the below JVM args also, but didnt make any difference.
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Any ideas on how to resolve this? Other datasources like prometheus datasource works fine and i am able to build visualizations from them.