JDBC and Alfresco

Skip to first unread message

Nick Nagels

Sep 22, 2011, 2:32:30 AM9/22/11
to javam...@googlegroups.com

I was trying to set up javamelody within Alfresco in a tomcat environment and cannot seem to get JDBC monitoring working.

The datasource bean below is used and the connection settings are in a properties file.

<bean id="defaultDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName">
        <property name="url">
        <property name="username">
        <property name="password">

I get this error: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

So it does not seem to pick up the properties,  it can however find the datasource reference and the application works as it should

Jdbc DataSource: java:comp/env/jdbc/dataSource which is the correct database reference name

Any ideas? It might be related to Alfresco, but I am hoping someone here got this working.

Thanks in advance

Emeric Vernat

Sep 24, 2011, 11:45:15 AM9/24/11
to javam...@googlegroups.com

It is quite strange that you speak about a dataSource from jndi (java:comp/env/jdbc/dataSource), given that you give a datasource configuration from a Spring context file which uses org.apache.commons.dbcp.BasicDataSource directly and which does not use your jndi datasource.

But anyway, we can probably ignore the jndi dataSource and use Spring to monitor the "defaultDataSource".
For that, you don't have to change the jdbc driver: you do not have to use net.bull.javamelody.JdbcDriver.

You can simply add "classpath:net/bull/javamelody/monitoring-spring.xml" in the web.xml file: open the web.xml file and find the contextConfigLocation, then add the monitoring-spring.xml like this :
It should be enough to monitor the "defaultDataSource" from your spring context and so the sql requests (because monitoring-spring.xml contains a post-processor for DataSources).
Note that I have not tested it myself with Alfresco.


By the way, you could also probably monitor various beans of Alfresco from your Spring context, see the following chapter:
You will have to define a pointcut based on an Alfresco interface or based on a jdk regexp for example. And it's up to you to find the beans which can and should be monitored.

Reply all
Reply to author
0 new messages