I am trying to deploy a grails app (to production environment) to an Ubuntu 14.04 server running on an AWS t2.micro instance. This application and deploying the Wars to the server have been working fine for over a year until this last few weeks. Now whenever I try to deploy the War I get the following errors in Tomcat log files and I am unable to start the application.This started without me making any changed to the server configuration myself.
07-Jun-2016 18:01:51.553 SEVERE [localhost-startStop-3] org.apache.catalina.core.StandardContext.startInternal Error listenerStart
07-Jun-2016 18:01:51.559 SEVERE [localhost-startStop-3] org.apache.catalina.core.StandardContext.startInternal Context [/appname] startup failed due to previous errors
07-Jun-2016 18:01:51.570 WARNING [localhost-startStop-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [appname] 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.
07-Jun-2016 18:01:51.571 WARNING [localhost-startStop-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [appname] 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:
Further Details:
- Grails 2.5.4 (have also tried downgrading to 2.5.0 and 2.4.4)
- Mysql 5.6 running on AWS RDS (securitygroups set up correctly and working)
- Tomcat 8.0.21 running on server
- Java 1.8.0 Oracle version (have also tried Openjava version)
I have searched a lot (I do not considered this a duplicate just because the error message is the same though as the solutions that fixed others do not work for me) and tried a lot of different possible configuration changes and solutions but nothing has worked so far I have tried :
From this question stackoverflow.com/questions/3320400
I have tried moving the JDBC driver to Tomcat's /lib folder and removing it from the \WEB-INF\lib\ in the War file before deploying it.
I have tried downgrading to tomcat version 6 (also tried installing 7, 8 and 9 versions)
I have a version in a war file that is currently live on the production server and I also have that code in github that was committed when I went live with that version BUT if I checkout that version and create a War from it to deploy it I get the errors (but deploying the original war still works. I have also tried checking out earlier version well before I had these issues and I get teh same problem. This suggests to me it is something to do with the environment either on my machine or the server but I have the same version of Java, Tomcat Mysql etc on both. The only real differences are that I develop on a Windows Machine and production is Ubuntu, and I have local Mysql server on same machine and production is separate RDS instance.
I have also tried deleting tomcat temp directory and restarting as sugggested in Tomcat fails to start because of jdbc driver loading
UPDATE
Checking the tomcat localhost log files when deploying I get the following entries:
08-Jun-2016 09:52:24.860 INFO [http-nio-8080-exec-10] org.apache.catalina.core.ApplicationContext.log Destroying Spring FrameworkServlet 'gsp'
08-Jun-2016 09:52:24.984 INFO [http-nio-8080-exec-10] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
08-Jun-2016 09:52:57.928 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
08-Jun-2016 09:52:58.863 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
I do not know if this is relevant or not though (will research)
UPDATE 2 I didnt find out exactly what the issue was but it was caused by the plugins / BuildConfig file. I went back to a barebones configuration by creating a new TestApplication which deployed without problems. I then used that Buildconfig and one by one added the plugins I required for my live app to work until I found one that caused the deployment issue. I could recreate the issue by enabling rest-client-builder:2.1.1 but also by using hibernate4:4.3.8.1 instead of Hibernate:3.6.10.19. I also found a much (over 8 months old) older version of the code base that I could create a war from and deploy with out problems so I have been readding all the newer features to that codebase , testing , deploying carefully to try to get back to where I was and so far without problems. It has meant I am now on grails 2.4.4 but if things are working I dont have a need to upgrade to a newer version.