aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-12-29 01:27:20 +0300
committerGravatar Vitaly Takmazov2015-12-29 01:27:20 +0300
commit7688805217f71eba913a644a4d1d38a394dd7d76 (patch)
tree7080647a37df4c4fcd2d18c69ed92ca95a7d9938 /src/main/java/com/juick
parent76030dc1a021cc9fb83bdd65aa21b8f2580fc24b (diff)
push: fix sql loading in listeners
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/CrosspostComponent.java3
-rw-r--r--src/main/java/com/juick/PushComponent.java3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/juick/CrosspostComponent.java b/src/main/java/com/juick/CrosspostComponent.java
index 1df68493..f6d830ec 100644
--- a/src/main/java/com/juick/CrosspostComponent.java
+++ b/src/main/java/com/juick/CrosspostComponent.java
@@ -125,11 +125,14 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea
public void setupSql(String host, String username, String password, String database) {
try {
+ Class.forName("com.mysql.jdbc.Driver");
sql = DriverManager.getConnection(
String.format("jdbc:mysql://%s/%s?autoReconnect=true&user=%s&password=%s",
host, database, username, password));
} catch (SQLException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (ClassNotFoundException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
}
}
diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java
index a813f1a2..7b6c90ec 100644
--- a/src/main/java/com/juick/PushComponent.java
+++ b/src/main/java/com/juick/PushComponent.java
@@ -125,11 +125,14 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe
public void setupSql(String host, String username, String password, String database) {
try {
+ Class.forName("com.mysql.jdbc.Driver");
sql = DriverManager.getConnection(
String.format("jdbc:mysql://%s/%s?autoReconnect=true&user=%s&password=%s",
host, database, username, password));
} catch (SQLException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
+ } catch (ClassNotFoundException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
}
}