AWSのRDSにMySQLをインストールして
サーブレットでMySQLに接続したいのですが、
できない状況です。
環境はMac OS X 10.9でeclipse Luna 4.4を用いて開発をおこなっており、
localhostからRDSのMySQLへ接続しようとしています。
その時のサーブレットのコードは以下のとおりです。
java
1private Connection connect = null; 2 private String url = 3 "jdbc:mysql://インタンス名.cvwnt4utponq.ap-northeast-1.rds.amazonaws.com:3306/データベース名"; 4 private String user = "ユーザー名"; // ユーザー名 5 private String password = "パスワード"; // パスワード 6 7 // SQLに接続するメソッド 8 public void connect() throws Exception { 9 Class.forName("com.mysql.jdbc.Driver"); 10 // .newInstance() 11 connect = DriverManager.getConnection(url, user, password); 12 } 13 14 // SQLを切断するメソッド 15 public void close() { 16 try { 17 connect.close(); 18 } catch (Exception e) { 19 e.printStackTrace(); 20 } 21 }
追記
28-Jul-2015 00:18:30.029 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/EGlunch] 28-Jul-2015 00:18:30.041 WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [EGlunch] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 28-Jul-2015 00:18:30.050 WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [EGlunch] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43) 28-Jul-2015 00:18:30.057 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/usr/share/tomcat8/work/Catalina/localhost/EGlunch] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.058 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.delete [/usr/share/tomcat8/work/Catalina/localhost/EGlunch] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.058 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/META-INF] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.058 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/fb] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.059 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/mail] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.059 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/search] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.059 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/dao] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.060 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/offer] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.060 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/beans] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.061 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/tomorrowlunch] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.063 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/message] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.063 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes/profile] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.064 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/classes] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.064 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF/lib] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.071 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.071 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/js] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.072 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/css] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.072 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/fonts] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.073 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/image/images/images] could not be completely deleted. The presence of the remaining files may cause problems 28-Jul-2015 00:18:30.074 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.ExpandWar.deleteDir [/var/lib/tomcat8/webapps/EGlunch/image/images] could not be completely deleted. The presence of the remaining files may cause problems ・・・ 28-Jul-2015 00:18:30.108 SEVERE [localhost-startStop-2] org.apache.catalina.startup.ContextConfig.beforeStart Exception fixing docBase for context [/EGlunch] java.io.IOException: [/var/lib/tomcat8/webapps/EGlunch] could not be completely deleted. The presence of the remaining files may cause problems at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:109) at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:618) at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:744) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
以後もエラーが続きます。

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/27 07:52
2015/07/27 07:56
2015/07/27 08:48 編集
2015/07/27 08:55 編集
2015/07/27 08:49
2015/07/27 08:52 編集
2015/07/27 09:09
2015/07/27 09:11
2015/07/27 09:15
2015/07/27 09:15
2015/07/27 09:21
2015/07/27 09:26
2015/07/27 09:31
2015/07/27 09:36
2015/07/27 09:51
2015/07/27 10:06 編集
2015/07/27 10:34
2015/07/27 14:04
2015/07/27 14:13
2015/07/27 14:48
2015/07/27 15:19
2015/07/27 15:22
2015/07/27 15:23
2015/07/28 00:48
2015/07/28 00:58
2015/07/28 01:01
2015/07/28 01:39
2015/07/28 01:47