configuration issue

View: New views
5 Messages — Rating Filter:   Alert me  

configuration issue

by pir8ped :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have spent days and days chasing this error:

Cannot create JDBC driver of class '' for connect URL 'null'

I have now resolved the issue.

This was my configuration:

META-INF/context.xml:

<Context debug="3" reloadable="true">
   <Resource name="compatMYSQL" auth="Container" type="javax.sql.DataSource"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/appName"
    username="user"
    password="pass"
    maxActive="10"
    maxIdle="5"
    validationQuery="SELECT 1"
    testOnBorrow="true"
    testWhileIdle="true"
    timeBetweenEvictionRunsMillis="10000"
    minEvictableIdleTimeMillis="60000"
    maxWait="5000"
    removeAbandoned="true"
    removeAbandonedTimeout="60"
    logAbandoned="true"
    noTimezoneConversionForTimeType="true"    />
</Context>


in web.xml:

<resource-ref>
                <res-ref-name>compatMYSQL</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>


This arrangement works on my local machine, but it throws the error on my
hosting server ( private JVM, Tomcat 6, on *nix *Virtual* Private *Server )

To fix it, I had to delete *META-INF/context.xml, and put the context info
in server.xml ( which the Tomcat documentation recommends NOT doing).

Why would my original config not work?

After spending so long resolving this, I am curious as to why it happened.

Any comments most welcome, thanks,

John Pedersen

Re: configuration issue

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John,

John Pedersen wrote:
| Cannot create JDBC driver of class '' for connect URL 'null'

This comes up quite often. Unfortunately, any number of bad
configuration options can result in this message.

|    <Resource name="compatMYSQL" auth="Container"
type="javax.sql.DataSource"

The resource name is usually of the form "jdbc/compatMYSQL".

|     factory="org.apache.commons.dbcp.BasicDataSourceFactory"

You should not need to specify this, though it shouldn't hurt.

| This arrangement works on my local machine, but it throws the error on my
| hosting server ( private JVM, Tomcat 6, on *nix *Virtual* Private
*Server )

Where is mysql-connector-x.y.z.jar installed on your local server? On
the hosting server? Make sure that your JDBC library exists only in a
single place on the server. For our projects, we put it in common/lib
(on TC 5.5... I think it's just /lib for TC 6).

| To fix it, I had to delete *META-INF/context.xml, and put the context info
| in server.xml ( which the Tomcat documentation recommends NOT doing).

Yeah, put it back into context.xml... it should work if everything else
is okay.

| After spending so long resolving this, I am curious as to why it happened.

These things usually get resolved when the configuration is re-written.
Some little tiny thing was typo'd or mis-copied or whatever and the
re-write fixes everything. Nobody keeps the old config and bothers to do
a diff, so the exact cause usually remains a mystery. :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgrJGsACgkQ9CaO5/Lv0PDq7ACguIqHUxG921HyIQmNl/DFE1l7
q1cAnixURkbRUBwWj1dDtksjoqDb7lP+
=I1i2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: configuration issue

by pir8ped :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/5/14 Christopher Schultz <chris@...>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> John,
>
> John Pedersen wrote:
> | Cannot create JDBC driver of class '' for connect URL 'null'
>
> This comes up quite often. Unfortunately, any number of bad
> configuration options can result in this message.


You 're - it is a common error. Shame the message isn't more specific about
what is causing it.

>
>
> |    <Resource name="compatMYSQL" auth="Container"
> type="javax.sql.DataSource"
>
> The resource name is usually of the form "jdbc/compatMYSQL".


I had that at one stage.  But without the jdbc/ seems to work as well.

>
>
> |     factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>
> You should not need to specify this, though it shouldn't hurt.
>
> | This arrangement works on my local machine, but it throws the error on my
> | hosting server ( private JVM, Tomcat 6, on *nix *Virtual* Private
> *Server )
>
> Where is mysql-connector-x.y.z.jar installed on your local server? On
> the hosting server? Make sure that your JDBC library exists only in a
> single place on the server. For our projects, we put it in common/lib
> (on TC 5.5... I think it's just /lib for TC 6).


Yep, in /lib, it is TC 6

>
>
> | To fix it, I had to delete *META-INF/context.xml, and put the context
> info
> | in server.xml ( which the Tomcat documentation recommends NOT doing).
>
> Yeah, put it back into context.xml... it should work if everything else
> is okay.


This is the point! It should work, but it doesn't. It ONLY works with the
config info in server.xml

>
>
> | After spending so long resolving this, I am curious as to why it
> happened.
>
> These things usually get resolved when the configuration is re-written.
> Some little tiny thing was typo'd or mis-copied or whatever and the
> re-write fixes everything. Nobody keeps the old config and bothers to do
> a diff, so the exact cause usually remains a mystery. :)
>

I've spent SOOO long on it, it is hard to let go! I am curious why it might
work only with server.xml, and not in META-INF/context.xml.

Re: configuration issue

by markt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Pedersen wrote:
>     factory="org.apache.commons.dbcp.BasicDataSourceFactory"

This means you must supply commons-dbcp (and probably commons-pool) rather
than use the packaged renamed versions in Tomcat. Is this what you intended?

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: configuration issue

by pir8ped :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark,

I did have this running, but switched back to using:

org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

and got rid of commons-dbcp, in the interests of keeping things as simple as
possible.

Thanks for pointing this out.

John

2008/5/14 Mark Thomas <markt@...>:

> John Pedersen wrote:
>
>>    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>>
>
> This means you must supply commons-dbcp (and probably commons-pool) rather
> than use the packaged renamed versions in Tomcat. Is this what you intended?
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>