You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Maxted <pa...@aricent.com> on 2009/03/03 17:49:44 UTC

RE: Cannot create JDBC driver of class '' for connect URL 'null'Causedby: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)

Good call P! I tried connecting to the database from the command line and was not able to. Another difference between Windows and Linux it seems as the user was defined the same in both cases. Now I have copied the user to use host 'localhost' as well as '@' and it works.

I have to say that the exception thrown is just a little misleading (typical British understatement there!)

ThanKs, Paul
________________________________________
From: Pid [p@pidster.com]
Sent: 03 March 2009 16:26
To: Tomcat Users List
Subject: Re: Cannot create JDBC driver of class '' for connect URL              'null'Causedby: java.lang.NullPointerException at               sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)

Paul Maxted wrote:
> Hello again,
>
> Thanks for your swift responses - apologies for the length of the original, but I see so many  posts where people immediately ask for more details!
>
> David, I have tried dropping the validation query and I also tried rolling back the version of  mysql-connector-java to 5.0.8 in case the mismatch between that and the MySQL version was relevant.
> Neither has changed the outcome.
>
> Any further thoughts?

Can you connect to the DB using the command line mysql client program &
the credentials you're trying to use?  (I think that's a different error
message, but worth checking anyway).

I recently ran into the same unhelpful error message and found that the
war redeployment process wasn't removing the
tomcat/conf/Catalina/myhost/mycontext.xml file, which contained stale
information from an earlier deployment.

Delete the war, remove the copied context.xml from conf & trying putting
a freshly built war back.


p




> Regards, Paul
> ________________________________________
> From: Pid [p@pidster.com]
> Sent: 03 March 2009 15:02
> To: Tomcat Users List
> Subject: Re: Cannot create JDBC driver of class '' for connect URL      'null'Caused by: java.lang.NullPointerException at      sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
>
> David Smith wrote:
>> Pid wrote:
>>> Paul Maxted wrote:
>>>
>>>> Hello, I need some help with my database access application.
>>>>
>>>> I am running Tomcat 6.0.16-6.4 installed from the OpenSUSE repositories. I am trying to connect to MySQL 5.0.51a-27.2.
>>>> I have mysql-connector-java-5.1.7-bin.jar in the tomcat6/lib directory.
>>>>
>>>> I have not modified server.xml or context.xml in tomcat6/conf - I include them for reference
>>>>
>> ....
>>> where's the DB driver?
>>> it's not in your war/lib...
>>>
>>>
>>> p
>>>
>>>
>>>
>> See the top of the message.  The OP included that info in the
>> introductory part.  It's in the correct place for tomcat 6.
>
> So he did, I must have lost that in all the scrolling...
>
> p
>
>
>
>> --David
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> "DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error,please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error,please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot create JDBC driver of class '' for connect URL 'null'Causedby: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)

Posted by Pid <p...@pidster.com>.
Christopher Schultz wrote:
> Paul,
> 
> On 3/3/2009 11:49 AM, Paul Maxted wrote:
>> Good call P! I tried connecting to the database from the command line
>> and was not able to.
> 
> I'm surprised that this was the error. Usually, you'll get a message
> like "SQLException: Cannot connect to database using password: NO" or
> something like that. Perhaps you fixed two problems at once.

my money's on a stale context.xml.

>> Another difference between Windows and Linux it
>> seems as the user was defined the same in both cases. Now I have
>> copied the user to use host 'localhost' as well as '@' and it works.
> 
> AFAIK, MySQL doesn't use "@" to mean anything. "%" is used to mean "any
> host", but localhost should also be defined.
> 
> When in doubt, use the GRANT command.
> 
>> I have to say that the exception thrown is just a little misleading
>> (typical British understatement there!)
> 
> This exception message is so irritating because it provides absolutely
> no information at all. It suggests that the driver class name is null,
> but that's not the case. This issue comes up again and again on the
> list, and nobody is ever really sure what the ultimate "fix" is. In my
> case, simply re-entering the configuration from scratch seems to be the
> best thing to do (and check those JARs).

maybe the DBCP replacement (o.a.tomcat.jdbc.pool) Filip is working on
will improve on this...

p



> -chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot create JDBC driver of class '' for connect URL 'null'Causedby: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

On 3/3/2009 11:49 AM, Paul Maxted wrote:
> Good call P! I tried connecting to the database from the command line
> and was not able to.

I'm surprised that this was the error. Usually, you'll get a message
like "SQLException: Cannot connect to database using password: NO" or
something like that. Perhaps you fixed two problems at once.

> Another difference between Windows and Linux it
> seems as the user was defined the same in both cases. Now I have
> copied the user to use host 'localhost' as well as '@' and it works.

AFAIK, MySQL doesn't use "@" to mean anything. "%" is used to mean "any
host", but localhost should also be defined.

When in doubt, use the GRANT command.

> I have to say that the exception thrown is just a little misleading
> (typical British understatement there!)

This exception message is so irritating because it provides absolutely
no information at all. It suggests that the driver class name is null,
but that's not the case. This issue comes up again and again on the
list, and nobody is ever really sure what the ultimate "fix" is. In my
case, simply re-entering the configuration from scratch seems to be the
best thing to do (and check those JARs).

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

iEYEARECAAYFAkmtbMMACgkQ9CaO5/Lv0PA1XQCfSVKCLBwoBzDHH6NLxQJ8r6Ek
Qf0An3J38gpf8vHQPxdOnt8PsNtZXRV7
=Yjrp
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org