I can not for the life of me figure out what is causing this
Brandon Potter
Greenhorn
Joined: Jul 22, 2011
Posts: 14
posted
0
I have a database built in mySQL on an internal network, using a BitNami Tomcat stack enviroment on a windows 7 enterprise machine, and am attempting to build a web interface for it. I know jsp, and have done a good amount of work in it, however I am having problems connecting to my database. FOllowing is example of the code, errors, and anything else I can think of, please let me know what you think.
Section of code attempting to connect with:
<%@ page import="java.sql.*" %>
<HTML>
<HEAD>
<TITLE>Query Results Using JSP</TITLE>
</HEAD>
<BODY>
<p>RAWR</p>
<% try
{ // Load driver class
Class.forName("com.mysql.jdbc.Driver");
}
catch (java.lang.ClassNotFoundException e) {
System.err.println("ClassNotFoundException: " +e);
}
%>
log fil from my SQL
C:\Program Files\BitNami Apache Tomcat Stack\mysql\bin\mysqld.exe, Version: 5.1.56-community-log (MySQL Community Server (GPL)). started with:
TCP Port: 3306, Named Pipe: MySQL
Time Id Command Argument
ERRORS:
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: An exception occurred processing JSP page /VirusList.jsp at line 28
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.VirusList_jsp._jspService(VirusList_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2260)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
java.sql.DriverManager.getConnection(DriverManager.java:582)
java.sql.DriverManager.getConnection(DriverManager.java:185)
org.apache.jsp.VirusList_jsp._jspService(VirusList_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
java.sql.DriverManager.getConnection(DriverManager.java:582)
java.sql.DriverManager.getConnection(DriverManager.java:185)
org.apache.jsp.VirusList_jsp._jspService(VirusList_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.net.ConnectException: Connection refused: connect
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:218)
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
java.sql.DriverManager.getConnection(DriverManager.java:582)
java.sql.DriverManager.getConnection(DriverManager.java:185)
org.apache.jsp.VirusList_jsp._jspService(VirusList_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs.
The log seems to indicate that the JDBC driver can't connect to the database server socket. Are you sure the database connection URL is correct? Is there a database running on port 3304?
Brandon Potter
Greenhorn
Joined: Jul 22, 2011
Posts: 14
posted
0
Ok, thanks for that tip, however now is where the trouble starts. I can not for the life of me find out how to actually setup the socket on windows 7, I have spent the last couple hours trying to find a guide on that part.
This is my first time setting up a mySQL database, and this part is really turning out to be a pain! here is a section of a log file, that I think is showing exactly what the problem is, I just don't know how to fix it.
Any help would be greatly appreciated, and thank you all.
Version: '5.1.56-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
110723 4:02:55 [Note] C:\Program Files\BitNami Apache Tomcat Stack\mysql\bin\mysqld.exe: Normal shutdown
110723 4:03:46 [Note] Plugin 'FEDERATED' is disabled.
110723 4:03:47 InnoDB: Error: unable to create temporary file; errno: 2
110723 4:03:47 [ERROR] Plugin 'InnoDB' init function returned error.
110723 4:03:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
110723 4:03:50 [Note] Event Scheduler: Loaded 0 events
110723 4:03:50 [Note] C:\Program Files\BitNami Apache Tomcat Stack\mysql\bin\mysqld.exe: ready for connections.
Version: '5.1.56-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
Brandon Potter
Greenhorn
Joined: Jul 22, 2011
Posts: 14
posted
0
I have the feeling that this has something to do with setting up the context files, and doing that properly, but I am hungover, and right now the context files documentation is just not making sense to me at all, I suppose I should move this post now to a different forum......
Thanks!
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35252
7
posted
0
The first thing I notice is that the JSP wants to connect to port 3304, whereas the DB seems to listen on port 3306.