me0wster / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

JIRA: Unable to create driver class for url #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. change dbconfig.xml elements
from working config
    <url>jdbc:jtds:sqlserver://localhost:1433/jira5</url>
    <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
to supposed to be working config

    <url>jdbc:jtds:sqlserver://localhost:1433/jira5</url>
    <driver-class>net.bull.javamelody.JdbcDriver</driver-class>
    <connection-properties>driver=net.sourceforge.jtds.jdbc.Driver</connection-properties>

2. start jira
3. observe exception in log

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 
'net.bull.javamelody.JdbcDriver' for connect URL 
'jdbc:jtds:sqlserver://localhost:1433/jira5'

What is the expected output? What do you see instead?
JIRA should just start and work.
It does work for jira 4.3.3 (Windows server 2003 x86), not for 5.0.6

What version of the product are you using? On what application server, JDK,
operating system?

Windows Server 2008 x64, JDK 1.6.29, JIRA 5.06, jtds 1.2.4
Please provide any additional information below.

2012-06-08 13:24:42,682 main ERROR      [NoModule] Error getting datasource via 
DBCP: JdbcDatasourceInfo{uri='jdbc:jtds:sqlserver://localhost:1433/jira5', 
driverClassName='net.bull.javamelody.JdbcDriver', username='jirauser', 
password='********', isolationLevel='null', 
connectionProperties={driver=net.sourceforge.jtds.jdbc.Driver}, 
connectionPoolInfo=ConnectionPoolInfo{maxSize=50, minSize=2, maxWait=60000, 
sleepTime=300000, lifeTime=600000, deadLockMaxWait=600000, 
deadLockRetryWait=10000, validationQuery='null', minEvictableTimeMillis=null, 
timeBetweenEvictionRunsMillis=null}}
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 
'net.bull.javamelody.JdbcDriver' for connect URL 
'jdbc:jtds:sqlserver://localhost:1433/jira5'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:1134)
    at org.ofbiz.core.entity.transaction.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:123)
    at org.ofbiz.core.entity.ConnectionFactory.tryGenericConnectionSources(ConnectionFactory.java:69)
    at org.ofbiz.core.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:146)
    at org.ofbiz.core.entity.TransactionFactory.getConnection(TransactionFactory.java:101)
    at org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:59)
    at com.atlassian.jira.ofbiz.DefaultOfBizConnectionFactory.getConnection(DefaultOfBizConnectionFactory.java:28)
    at com.atlassian.jira.upgrade.util.UpgradeUtils.tableExists(UpgradeUtils.java:100)
    at com.atlassian.jira.appconsistency.db.MinimumUpgradableVersionCheck.databaseSetup(MinimumUpgradableVersionCheck.java:49)
    at com.atlassian.jira.appconsistency.db.MinimumUpgradableVersionCheck.isOk(MinimumUpgradableVersionCheck.java:30)
    at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.doStartupChecks(JiraDatabaseConfigChecklist.java:65)
    at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.startupOK(JiraDatabaseConfigChecklist.java:53)
    at com.atlassian.jira.startup.DatabaseChecklistLauncher.start(DatabaseChecklistLauncher.java:35)
    at com.atlassian.jira.startup.DefaultJiraLauncher$2.run(DefaultJiraLauncher.java:90)
    at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:250)
    at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseConfigured(DatabaseConfigurationManagerImpl.java:155)
    at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:85)
    at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:24)
    at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:61)
    at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33)
    at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:56)
    at com.atlassian.jira.startup.LauncherContextListener$1.create(LauncherContextListener.java:67)
    at com.atlassian.jira.startup.LauncherContextListener$1.create(LauncherContextListener.java:62)
    at com.atlassian.multitenant.impl.MultiTenantComponentMapImpl.get(MultiTenantComponentMapImpl.java:121)
    at com.atlassian.multitenant.impl.MultiTenantComponentMapImpl.onTenantStart(MultiTenantComponentMapImpl.java:165)
    at com.atlassian.multitenant.impl.DefaultMultiTenantManager$1.consume(DefaultMultiTenantManager.java:134)
    at com.atlassian.multitenant.impl.DefaultMultiTenantManager$1.consume(DefaultMultiTenantManager.java:131)
    at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForEachListener(DefaultMultiTenantManager.java:256)
    at com.atlassian.multitenant.impl.DefaultMultiTenantManager.startTenant(DefaultMultiTenantManager.java:130)
    at com.atlassian.multitenant.impl.DefaultMultiTenantManager.startAll(DefaultMultiTenantManager.java:203)
    at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:95)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:264)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)

Original issue reported on code.google.com by valentijnscholten on 8 Jun 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Adding my log output, as it provides more environment info.

Original comment by ad...@72hills.com on 8 Jun 2012 at 8:36

Attachments:

GoogleCodeExporter commented 9 years ago
I have reproduced the issue using JIRA 5.0.

It seems to me that using the javamelody JdbcDriver in dbconfig.xml does not 
work anymore since JIRA 5.0.
And it is probably because JIRA or the ofbiz entityengine calls 
setDriverClassLoader on the commons dbcp datasource. I do not know what 
contains this classLoader but it probably does not contain the plugins classes.

So I suggest that the dbconfig.xml of JIRA should not be changed anymore for 
javamelody (doc to be fixed).
Instead you can use a JNDI datasource and it will be monitored automatically.

As said in the user guide [1]:

Or you could just use a jndi datasource in JIRA 4.4 or later and it will be 
automatically monitored. To use a jndi datasource, replace in the dbconfig.xml 
file "<jdbc-datasource>...</jdbc-datasource>" with 
"<jndi-datasource><jndi-name>java:comp/env/jdbc/JiraDS</jndi-name></jndi-datasou
rce>" (take a backup before), and add a Resource element for a datasource 
inside the Context element of the Tomcat's "JIRA/conf/server.xml" file. 

    See this example [2] of datasource for mysql; the values in your Resource element should be inspired by the values that were just removed from your dbconfig.xml file. And so the jndi datasource will be automatically monitored after restart. 

[1] 
https://code.google.com/p/javamelody/wiki/UserGuide#Atlassian_JIRA,_Confluence_a
nd_Bamboo_Plugin
[2] 
http://confluence.atlassian.com/display/JIRA043/Connecting+JIRA+to+MySQL#Connect
ingJIRAtoMySQL-51ConfigureyourapplicationservertoconnecttoMySQL

Original comment by evernat@free.fr on 10 Jun 2012 at 12:03

GoogleCodeExporter commented 9 years ago
user guide updated as said above:
https://code.google.com/p/javamelody/wiki/UserGuide#Atlassian_JIRA,_Confluence_a
nd_Bamboo_Plugin

Original comment by evernat@free.fr on 10 Jun 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Thanks for the response.

For complete newbies it would be helpful to include instructions on how to 
configure java melody using connection property.

Is it something like this:

        <Engine name="Catalina" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

                <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">

                    <!--
                     ====================================================================================

                     Note, you no longer configure your database driver or connection parameters here.
                     These are configured through the UI during application setup.

                     ====================================================================================
                    -->

                     <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
                        username="jirauser]"
                        password="issuemeister"
                        driverClassName="net.bull.javamelody.JdbcDriver"
                        url="jdbc:jtds:sqlserver://localhost:1433/jira5"
                        connectionProperties="driver=net.sourceforge.jtds.jdbc.Driver" 
                        maxActive="20"
                        maxIdle="10"
                        validationQuery="select 1"
                     />

    <!--
    <driver-class>net.bull.javamelody.JdbcDriver</driver-class>
    <connection-properties>driver=net.sourceforge.jtds.jdbc.Driver</connection-properties>
    -->

                    <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
                              factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
                    <Manager pathname=""/>
                </Context>

            </Host>

This results in an exception on startup:
2012-06-11 12:08:16,995 main ERROR      
[atlassian.jira.startup.LauncherContextListener] Unable to start JIRA.
java.lang.RuntimeException: Unable to obtain a connection from the underlying 
connection pool
    at org.ofbiz.core.entity.jdbc.interceptors.connection.ConnectionTracker.trackConnection(ConnectionTracker.java:59)
    at ...
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC 
driver of class 'net.bull.javamelody.JdbcDriver' for connect URL 
'jdbc:jtds:sqlserver://localhost:1433/jira5'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
...
Caused by: java.sql.SQLException: No suitable driver
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1443)
    ... 50 more

Original comment by valentijnscholten on 11 Jun 2012 at 10:12

GoogleCodeExporter commented 9 years ago
Looks like you don't need the property anymore and also not the 
net.bull.javameldoy.jdbcdriver ????

Original comment by valentijnscholten on 11 Jun 2012 at 10:15

GoogleCodeExporter commented 9 years ago
Yes, there is no need of net.bull.javamelody.JdbcDriver when using a datasource 
as said in the user guide:
https://code.google.com/p/javamelody/wiki/UserGuide#Atlassian_JIRA,_Confluence_a
nd_Bamboo_Plugin

In your case with JTDS, it is the following in conf/server.xml:

<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" 
useHttpOnly="true">
                     <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
                        username="<user>"
                        password="<password>"
                driverClassName="net.sourceforge.jtds.jdbc.Driver"
                url="jdbc:jtds:sqlserver://localhost:1433/jira5"
                        maxActive="20"
                        maxIdle="10"
                        validationQuery="select 1"
                     />

                    <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
                              factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
                    <Manager pathname=""/>
                </Context>

An example from the Atlassian documentation, using Mysql, is here:
https://confluence.atlassian.com/display/JIRA043/Connecting+JIRA+to+MySQL#Connec
tingJIRAtoMySQL-51ConfigureyourapplicationservertoconnecttoMySQL

Original comment by evernat@free.fr on 11 Jun 2012 at 4:49

GoogleCodeExporter commented 9 years ago
Yeah thanks. in the end I got it.
I was confused because I thought I needed to use the 
net.bull.javameldoy.jdbcdriver also with the datasource.

Original comment by valentijnscholten on 11 Jun 2012 at 5:47