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

Mel,

On 3/23/2009 1:24 AM, Mel McGuire wrote:
> No problem seen with mysql or the mysql command line utility.
> Tomcat comes up and down alright.

[snip]

>              url="jdbc:mysql://localhost:3306/nlocalhost"
>              removeAbandoned="true"
>              removeAbandonedTimeout="120" />

I would add:
   logAbandoned="true"
   validationQuery="/* PING */ SELECT 1"

Note that using 'root' is probably not the best strategy, here. ;)

> HTTP Status 500 error report:
> --------------------------------------------------------------------
> java.lang.NullPointerException
>       PublicTopFrameset.doGet(PublicTopFrameset.java:109)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> --------------------------------------------------------------------

Obviously, your webapp should be checking for null references. I know
your problem is deeper than this, but this error is obviously your
code's fault.

> Tomcat error report:
> --------------------------------------------------------------------
> AbandonedObjectPool is used 
> (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool&b8f8eb)
>   LogAbandoned: false
>   RemoveAbandoned: true
>   RemoveAbandonedTimeout: 120
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
> PoolableConnectionFactory (Communications link failure
> Last packet sent to the server was 0 ms ago.)

This indicates that Java can't contact the server. You mentioned that
the mysql command-line utility connects just fine. Can you do this and
see what happens:

C> mysql -h 127.0.0.1 -u root -p nlocalhost

and see if that connects? I don't think win32 uses anything other than
TCP/IP for communication (*NIX systems can use a named pipe on the
filesystem and ignore networking altogether) but using 127.0.0.1 as the
host (/not/ "localhost") disables that behavior in the client.

>   private DataSource     dataSource     = null;
> 
>   public void init(ServletConfig config)
>    throws ServletException
>    {
>       super.init(config);
>       servletContext = config.getServletContext();
>       dataSource = (DataSource)servletContext.getAttribute("dataSource");

You really shouldn't do this. You should use JNDI to get the DataSource
each time you need it, rather than caching a copy of that object
somewhere (like the application scope, as you've done here).

A JNDI fetch is cheap and more robust (you can replace the DataSource at
runtime and everyone starts using it right away, instead of having to
bounce the app). Also, DataSource is not guaranteed to be threadsafe so
you never know if it will even work properly in a shared situation
(which you have here).

>        {  //The error occurs here.
>           con = dataSource.getConnection();

Right: you need to check for null ;)

> .When the mysql port is changed to 3308, the error message is the same. 
>  I conclude that the error occurs before there is an attempt to use
>  the mysql port?

Yes. Your machine can't contact MySQL. Stupid question: Is MySQL
running? (Probably, since you said the command-line works).

Also, are you running Tomcat under a security manager (i.e. with the
"-security" switch)? If so, you could have a permissions problem.

> .I bit on a Sun Java upgrade popup several weeks ago but I believe I tested
>  ok after it was installed. Anyway, the upgrade left a CLASSPATH variable
>  containing only jre6. I temporarily removed the CLASSPATH variable but
>  the problem persisted. I copied some .jar files into the new
>  jre6/lib/ext folder from the jre1.6.0_07/lib/ext folder. No luck.

You should ignore the CLASSPATH environment variable. When you installed
Tomcat, did you use the installer, or did you just unzip it? I'm asking
because I think the Tomcat service points to a specific JRE version. If
Tomcat is doing /anything/ (which it is), your upgrade doesn't appear to
have broken anything.

> .A few days ago, my computer hung at "shutting down" (first time ever) and I 
>  pulled the electrical plug and restarted. I don't belive I tested 
>  my app after the restart but I didn't notice anything else wrong.

I thought this was just called "running Microsoft windows". ;)

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

iEYEARECAAYFAknKLfQACgkQ9CaO5/Lv0PB4pgCeJtbNU3pU4OXbg02IuW7qneOZ
LE0An0Wc7CvmwC+Bm6tg3GjHLQvxBtsK
=JkQk
-----END PGP SIGNATURE-----

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

Reply via email to