Hi there, i'm trying to get a tomcat server running with mysql connectivity. Tomcat is 
running ok, and i've downloaded the new Connector/J, and copied the .jar file to 
$CATALINA_HOME/common/lib. I'm running Tomcat 5.0.16. The other JSPs work ok, but the 
ones that contain a connection to mysql, fail with this message:

<snip>

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from 
fulfilling this request.

exception

org.apache.jasper.JasperException
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

java.lang.NullPointerException
        org.apache.jsp.jspCounter_jsp._jspService(jspCounter_jsp.java:83)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.
Apache Tomcat/5.0.16

</snip>

I don't know anything about Java, but i think that the 'NullPointerException' is 
because it can't get a handler to communicate with MySQL.
The JSP file connects to MySQL like this:
<snip>

    String host = "localhost";
    String dbName = "MYDBNAME"; 
    String driver = "org.gjt.mm.mysql.Driver";
    String username = "MYUSERNAME";
    String password = "MYPASSWORD";
    String url = "jdbc:mysql://" + host + ":3306/" + dbName;
    String table = "counter";
    Connection connection             = null; 
    Statement statement               = null; 
    Statement statement2               = null;
    ResultSet resultSet               = null;
    ResultSetMetaData resultsMetaData = null;
    String query = "";
    try{
      Class.forName(driver) ;
      connection = DriverManager.getConnection(url, username, password);
      statement = connection.createStatement();

</snip>

I've seen in some example configuration files that you can specify a DB, username, 
password, etc. But i don't know if i have to do it, because this JSP specifies all 
that..

If someone could give me a helping hand, I would be more than grateful.

Regards,
Leandro Costa

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to