You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by m....@dsl.pipex.com on 2010/10/11 13:32:40 UTC
Connecting Tomcat 6.0.26 to MySQL 5.1
Hello
Having rebuilt my Windows PC, I am trying to get Tomcat running under NetBeans to connect to MySQL.
I believe MySQL is alright because the various tools retrieve data correctly. But when my Java web app is run from NetBeans, Tomcat shows the homepage but then gives a Java null pointer error. The logs tell me this is to do with retrieving user data from the database. So I'm assuming that the two system components are not able to talk to each other. But why?
I have mySQLConnector in the NetBeans library my web app is using. I've placed MySQL Connector in Tomcat's config folder, MySQL Connector is also in the classpath of the PC. The context.xml file in the web app is set to use the root user in MySQL and all relevant authorities in MySQL are set.
But I get nothing! Although I have the same tools on another PC and they are fine.
Any ideas? Is there something I've missed?
Thanks
Martin O'Shea.
Thanks
Martin O'Shea
Re: Connecting Tomcat 6.0.26 to MySQL 5.1
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin,
On 10/11/2010 7:32 AM, m.oshea@dsl.pipex.com wrote:
> Having rebuilt my Windows PC, I am trying to get Tomcat running
> under NetBeans to connect to MySQL.
If you were rebuilding, why did you stick with Microsoft Windows? :)
> I believe MySQL is alright because the various tools retrieve data
> correctly. But when my Java web app is run from NetBeans, Tomcat
> shows the homepage but then gives a Java null pointer error. The
> logs tell me this is to do with retrieving user data from the
> database. So I'm assuming that the two system components are not able
> to talk to each other. But why?
It could be anything. Care to show us the entire stack trace?
> I have mySQLConnector in the NetBeans library my web app is using.
> I've placed MySQL Connector in Tomcat's config folder,
Which folder? Please be specific.
> MySQL Connector is also in the classpath of the PC.
A normal Tomcat installation will ignore any CLASSPATH setting. You
should not try to use the CLASSPATH for anything at all. You should also
make sure that the MySQL Connector/J library is only available in one
place in the ClassLoader hierarchy: namely, in TOMCAT_HOME/lib.
> The context.xml file in the web app is set to use the root user in
> MySQL and all relevant authorities in MySQL are set.
This is a bad idea: you should use a MySQL user that doesn't have SUPER
privileges.
> Code seems to be wrong only in IE so must be something to do with
> security settings.
Sounds like you have a broken webapp.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAky3JNwACgkQ9CaO5/Lv0PCL+gCeN+F67BRlGu0e/rpiUBBcqa79
QQAAn1Ck4Gn+2uuHhpD6zdgLlC5r2R7P
=XofB
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org