I am trying to integrate JDBC Monitoring in JavaMelody. I use Tomcat jdbc pooled connections. My setup is like this (simplified):
Properties props = new Properties();
props.setProperty("driver", "com.mysql.jdbc.Driver");
PoolConfiguration p = new PoolProperties();
p.setDriverClassName("net.bull.javamelody.JdbcDriver");
p.setDbProperties(props);
p.setUsername("myusername");
p.setPassword("mypassword");
p.setUrl(connectionParameters.getUrl());
org.apache.tomcat.jdbc.pool.DataSource dataSource = new org.apache.tomcat.jdbc.pool.DataSource();
dataSource.setPoolProperties(p);
(I prefer this setup over a <context> description in web.xml)
I get following Exception
java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/mydatabase?autoReconnect=true&characterEncoding=UTF-8 at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:187) at net.bull.javamelody.JdbcDriver.connect(JdbcDriver.java:83) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278) at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182) at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701) at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635) at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486) at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:144) at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116) at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) at ... (my methods)
Without javamelody its running fine, javamelody in general is running fine.
What am I doing wrong? Any ideas?