You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Filchak <su...@zuka.net> on 2011/09/18 16:52:47 UTC

database error

Hello,

I had email a while ago asking for help with some errors I was getting 
with an application that I inherited which was working OK but was 
getting a few errors after moving it to a new server. I am not a tomcat 
person in that I do not know a lot about it but do know my way around a 
server pretty well. I did manage to fix a number of the issues with help 
from a few generous souls but now am receiving a database connection error:

Error initializing sub-systems:
Please check the following:
1. That your machine has a valid connection to jdbc:mysql://localhost/exodus_exodus Using:
    Username: xxxxxx
    Password: xxxxx
    Driver: com.mysql.jdbc.Driver

I have verified that the user/pass is correct via a command-line log in. 
So, then checking the 
/home/xxxxx/public_html/WEB-INF/conf/environment.xml, it all looks 
correct as far as the database info is concerned. I do notice that 
things like the <path> in this file contains entries that are wrong. For 
example, 
<systemLogFolder>/usr/local/tomcat/webapps/exodus/WEB-INF/logs/</systemLogFolder> 
should actually be 
<systemLogFolder>/usr/local/jakarta/tomcat/webapps/exodus/WEB-INF/logs/</systemLogFolder>except 
that the exodus folder does not exist under webapps. This 
misconfiguration is consistent with all the entries under <path>. The 
entire exodus app is actually under the web root so I am not sure what 
if anything I would have to do here. Should I simply create these 
folders under /usr/local/jakarta/tomcat/webapps/ ??

As I really do not have a load of experience with tomcat, I wold 
appreciate any insight anyone can give be as to how I might go about 
repairing this error.

Cheers,

Dave

Re: [OT] database error

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

Dave,

(Marking off-topic because I don't think this is a Tomcat-specific issue)

On 9/18/2011 10:52 AM, Dave Filchak wrote:
> Error initializing sub-systems: Please check the following: 1.
> That your machine has a valid connection to 
> jdbc:mysql://localhost/exodus_exodus Using: Username: xxxxxx 
> Password: xxxxx Driver: com.mysql.jdbc.Driver

That's not a Tomcat error message: are you doing your own database
connection management (or do you know if you are)?

> I have verified that the user/pass is correct via a command-line 
> log in.

Did you do that from the same machine where Tomcat runs?

If you are using a *NIX machine, you can connect using a named pipe OR
using sockets. If you have "skip-networking" set in /etc/mysql/my.cnf
then MySQL will not listen on a socket and you must connect using the
named pipe. Connector/J can't use the named pipe: it must use TCP/IP
for communication. So, make sure you haven't disabled sockets for MySQL.

> So, then checking the 
> /home/xxxxx/public_html/WEB-INF/conf/environment.xml, it all looks 
> correct as far as the database info is concerned.

AFAIK, WEB-INF/conf/environment.xml isn't used by Tomcat to initialize
any kind of database connection or DataSource (aka "connection pool").

> I do notice that things like the <path> in this file contains 
> entries that are wrong. For example, 
> <systemLogFolder>/usr/local/tomcat/webapps/exodus/WEB-INF/logs/</systemLogFolder>
>
>
> 
should actually be
> <systemLogFolder>/usr/local/jakarta/tomcat/webapps/exodus/WEB-INF/logs/</systemLogFolder>except
>
>
> 
that the exodus folder does not exist under webapps.

So the path is wrong and so is the path you think it should be? I'm
confused.

So... Jakarta? What version of Tomcat are you using?

> This misconfiguration is consistent with all the entries under 
> <path>. The entire exodus app is actually under the web root so I 
> am not sure what if anything I would have to do here. Should I 
> simply create these folders under 
> /usr/local/jakarta/tomcat/webapps/ ??

Probably not. You probably don't want things like logs to be put into
the webapp's deployment directory: they will be deleted if you
undeploy the webapp :(

Try putting them in /usr/local/jakarta/tomcat/

> As I really do not have a load of experience with tomcat, I wold 
> appreciate any insight anyone can give be as to how I might go 
> about repairing this error.

The real question is how your JDBC connections are being managed. It
doesn't sound like Tomcat is being asked to do anything... maybe it's
some other component (like Spring) or maybe your web application
itself manages it's own database connections. You'll have to find that
out, first.

My from-the-hip expectation is that you are missing the Connector/J
JAR file. If your webapp is managing the connections, you should
probably have the JAR file in your webapp's WEB-INF/lib directory and
nowhere else.

There may be a memory leak if you do this (depending on your Tomcat
version and whether or not you use the DriverManager -- though I think
Connector/J self-registers so you don't have a choice in the matter).

Your will have a more-stable server if you can afford to put your
mysql-x.y.z.jar file into CATALINA_BASE/lib (or
CATALINA_BASE/common/lib depending on the version of TC you are
running). (You might not be able to do this if you have different
webapps that need different versions of the Connector/J library).

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk54zd0ACgkQ9CaO5/Lv0PBCBgCfS0C5V7oH+v7efh5fgMz+3hLQ
yD0An1Y07d1jOYMti4JJ8/BOwn4CKRl/
=oO2w
-----END PGP SIGNATURE-----

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