tomcat and mysql problem

12 views
Skip to first unread message

Fran

unread,
Mar 7, 2010, 7:27:39 PM3/7/10
to Google Web Toolkit
Hi,

I have a problem with a tomcat and MySQL driver.

If I use a tomcat instalation in Windows, it works fine.
If I put the aplication in a production server (Linux centoos), It
dont work.
This is the output of catalina.out


Mysql Connection Error:
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.

Anyone know this problem? Help me please!

Thanks

Fran

unread,
Mar 8, 2010, 8:40:38 AM3/8/10
to Google Web Toolkit
I cant understand what is the problem :(

is possible a problem with iptables?

Fran

unread,
Mar 8, 2010, 1:13:57 PM3/8/10
to Google Web Toolkit
help me please! :(

Fran

unread,
Mar 8, 2010, 1:21:25 PM3/8/10
to Google Web Toolkit
He is the GWT code:

public abstract class DB_Conn {

private String url;

public DB_Conn() {

url = "jdbc:mysql://xxxxxxxxxxxxxxx:3306/";
}

protected Connection getConn() {

Connection conn = null;

String url = getServerURL();

String db = "xxxxx";
String driver = "com.mysql.jdbc.Driver";
String user = "xxxxx";
String pass = "xxxxx";

try {

Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+db,
user, pass);

} catch (Exception e) {

System.err.println("Mysql Connection Error:
");
e.printStackTrace();
}

return conn;
}

private String getServerURL() {
return url;
}


protected static int getResultSetSize(ResultSet resultSet) {
int size = -1;

try {
resultSet.last();
size = resultSet.getRow();
resultSet.beforeFirst();
} catch(SQLException e) {
return size;
}

return size;

Chris Lercher

unread,
Mar 8, 2010, 2:18:42 PM3/8/10
to Google Web Toolkit
Hi Fran,

I don't think this question is related to GWT at all. Since your code
is certainly executed on the server side, this has only to do with two
projects: MySQL, and maybe Tomcat. While it's possible that someone
here knows your answer by chance, it's so much more likely that you
get lots of good answers, if you ask the question on MySQL (or maybe
Tomcat) forums.

Before you ask there, the first thing you should do, is to create a
new, simple test project, which doesn't use GWT or Tomcat at all, and
only uses the MySQL driver. This way, you'll see, if this has anything
to do with Tomcat (like e.g. driver conflicts...).

HTH to find your answer
Chris

Fran

unread,
Mar 8, 2010, 4:25:09 PM3/8/10
to google-we...@googlegroups.com
Thanks Chris,

I finally found the solutions.
It was the iptables configurations. Has been needed to write a OUTPUT rule in port 3306

2010/3/8 Chris Lercher <cl_for_...@gmx.net>
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Reply all
Reply to author
Forward
0 new messages