title: MySQLNonTransientConnectionException: Communications link failure during commit with mysql and mongodb in grails-2.2.2
body: <p>I am using Grails 2.2.2 with MySql. For a couple of my domains, I decided to go polygot with out db and introduced Mongo into the mix. This change went to production without any issues and was functional for over 12 hours. </p>
  
  <p>But suddenly then we started getting this exception in our logs:</p>
  
  <pre><code>caused by org.hibernate.TransactionException: JDBC commit failed
  com.sonyliv.common.VideoService.getRequestIp(VideoService.groovy:1301)
  com.sonyliv.portal.ApplicationFilters$_closure1_closure2_closure5.doCall(ApplicationFilters.groovy:14)
  …in.cache.web.filter.PageFragmentCachingFilter.doFilter (PageFragmentCachingFilter.java:195)
   grails.plugin.cache.web.filter.AbstractFilter.doFilter (AbstractFilter.java:63)
                   com.brandseye.cors.CorsFilter.doFilter (CorsFilter.java:69)
  ….javakaffee.web.msm.RequestTrackingContextValve.invoke (RequestTrackingContextValve.java:99)
    de.javakaffee.web.msm.RequestTrackingHostValve.invoke (RequestTrackingHostValve.java:151)
        java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
       java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
                                     java.lang.Thread.run (Thread.java:724)
  
  caused by com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.
                    com.mysql.jdbc.Util.handleNewInstance (Util.java:411)
                          com.mysql.jdbc.Util.getInstance (Util.java:386)
               com.mysql.jdbc.SQLError.createSQLException (SQLError.java:1014)
               com.mysql.jdbc.SQLError.createSQLException (SQLError.java:988)
               com.mysql.jdbc.SQLError.createSQLException (SQLError.java:974)
               com.mysql.jdbc.SQLError.createSQLException (SQLError.java:919)
                     com.mysql.jdbc.ConnectionImpl.commit (ConnectionImpl.java:1700)
      org.apache.commons.dbcp.DelegatingConnection.commit (DelegatingConnection.java:334)
  …cp.PoolingDataSource$PoolGuardConnectionWrapper.commit (PoolingDataSource.java:211)
  com.sonyliv.common.VideoService.getRequestIp(VideoService.groovy:1301)
  com.sonyliv.portal.ApplicationFilters$_closure1_closure2_closure5.doCall(ApplicationFilters.groovy:14)
  …in.cache.web.filter.PageFragmentCachingFilter.doFilter (PageFragmentCachingFilter.java:195)
   grails.plugin.cache.web.filter.AbstractFilter.doFilter (AbstractFilter.java:63)
                   com.brandseye.cors.CorsFilter.doFilter (CorsFilter.java:69)
  ….javakaffee.web.msm.RequestTrackingContextValve.invoke (RequestTrackingContextValve.java:99)
    de.javakaffee.web.msm.RequestTrackingHostValve.invoke (RequestTrackingHostValve.java:151)
        java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
       java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
  
                                         java.lang.Thread.run (Thread.java:724)
  </code></pre>
  
  <p>However, we were still able to log into mysql from our production server using our DataSource settings. I tried restarting the application, but that didn't help either. Finally, I had to revert back to a pre-mongo version to get things working again.</p>
  
  <p>Has anyone got any clues on why this might have happened? Is there a known issue with Grails 2.2.2 + Mysql + mongo. I have been trying to find out, but still have not got anything concrete. Versions of various techs:</p>
  
  <p>Mongo - 2.4.8</p>
  
  <p>Grails Mongo Plugin - 1.3.3</p>
  
  <p>Mysql - 5.5.33</p>
  
  <p>Tomcat 7</p>
  
  <p>Grails - 2.2.2</p>
  
  <p>Thanks in advance.</p>