title: hikari org.h2.jdbc.JdbcSQLException: Function "ST_ASGEOJSON" not found
body: <p>My resources.groovy looks like below: I am using two data sources in grails application: the environment configs are:</p>
  
  <p>HikariCP version: 2.3.5<br>
  JDK version     : 1.8.0_31<br>
  Database        : PostgreSQL  </p>
  
  <pre><code>   beans =  {
    switch(Environment.current.name ) {
      case Environment.DEVELOPMENT.name:
        hikariConfig1(HikariConfig) {
          poolName = 'HikariCP'
          driverClassName = "org.postgresql.Driver"
          jdbcUrl = 
  'jdbc:postgresql://db:9999/dbname'
          username = 'postgres'
          maximumPoolSize = '3'
        }
        hikariConfig2(HikariConfig) {
          poolName = 'HikariCP'
          driverClassName = "org.postgresql.Driver"
          jdbcUrl = 'jdbc:postgresql://database:9999/db'
          username = 'user'
          password = ''
          maximumPoolSize = '3'
        }
        break
  }
  </code></pre>
  
  <p>Works fine without hikari CP, but when I am using hikari for connection pooling in a grails project in Intellij I get the following error:</p>
  
  <pre><code>2017-04-11 12:50:26,152 [qtp767313210-26] ERROR o.h.e.j.s.SqlExceptionHelper - Function "ST_ASGEOJSON" not found; SQL statement:
  select this_.id as id1_3_0_, this_.active as active2_3_0_, this_.address as address3_3_0_, this_.city as city4_3_0_, this_.country_id as country_5_3_0_, this_.date_created as date_cre6_3_0_, this_.deleted as deleted7_3_0_, this_.email as email8_3_0_, this_.giata_id as giata_id9_3_0_, this_.name as name10_3_0_, this_.phone as phone11_3_0_, this_.postcode as postcod12_3_0_, this_.state as state13_3_0_, this_.last_updated as last_up14_3_0_, ST_AsGeoJSON(this_.geom) as formula10_0_ from hotel this_ where this_.id in (?) order by lower(this_.id) asc limit ? [90022-176]
  2017-04-11 12:50:26,183 [qtp767313210-26] ERROR c.e.e.GenericGathererController - gather: org.hibernate.exception.GenericJDBCException: could not prepare statement
  org.hibernate.exception.GenericJDBCException: could not prepare statement
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:160) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1885) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1862) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1839) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.doQuery(Loader.java:910) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.doList(Loader.java:2554) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.doList(Loader.java:2540) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.Loader.list(Loader.java:2365) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:126) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1718) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:380) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final]
      at org.grails.orm.hibernate.query.AbstractHibernateQuery.list(AbstractHibernateQuery.java:639) ~[grails-datastore-gorm-hibernate-core-4.0.7.RELEASE.jar:na]
      at grails.gorm.PagedResultList.initialize(PagedResultList.java:87) ~[grails-datastore-gorm-4.0.7.RELEASE.jar:na]
      at grails.gorm.PagedResultList.size(PagedResultList.java:93) ~[grails-datastore-gorm-4.0.7.RELEASE.jar:na]
      at java_util_List$size$1.call(Unknown Source) ~[na:na]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-2.4.5.jar:2.4.5]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-2.4.5.jar:2.4.5]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) ~[groovy-2.4.5.jar:2.4.5]
      at com.exciteholidays.elasticgatherer.services.GenericGathererService.gather(GenericGathererService.groovy:92) ~[main/:na]
      at com.exciteholidays.elasticgatherer.services.GenericGathererService$$FastClassBySpringCGLIB$$97b93a19.invoke(&lt;generated&gt;) ~[spring-core-4.1.8.RELEASE.jar:na]
      at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) ~[spring-aop-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at com.exciteholidays.elasticgatherer.services.GenericGathererService$$EnhancerBySpringCGLIB$$de33f2b5.gather(&lt;generated&gt;) ~[spring-core-4.1.8.RELEASE.jar:na]
      at com.exciteholidays.elasticgatherer.services.GenericGathererService$gather.call(Unknown Source) ~[na:na]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-2.4.5.jar:2.4.5]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-2.4.5.jar:2.4.5]
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) ~[groovy-2.4.5.jar:2.4.5]
      at com.exciteholidays.elasticgatherer.GenericGathererController.gather(GenericGathererController.groovy:19) ~[main/:na]
      at com.exciteholidays.elasticgatherer.GenericGathererController$$FastClassByCGLIB$$6422a58e.invoke(&lt;generated&gt;) [spring-core-4.1.8.RELEASE.jar:na]
      at org.springframework.cglib.reflect.FastMethod.invoke(FastMethod.java:53) [spring-core-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:172) [grails-core-3.0.11.jar:3.0.11]
      at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:87) [grails-web-url-mappings-3.0.11.jar:3.0.11]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) [spring-webmvc-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [javax.servlet-api-3.1.0.jar:3.1.0]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224) [websocket-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:299) [spring-boot-actuator-1.2.7.RELEASE.jar:1.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102) [spring-boot-actuator-1.2.7.RELEASE.jar:1.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:73) [grails-web-mvc-3.0.11.jar:3.0.11]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67) [grails-web-mvc-3.0.11.jar:3.0.11]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:76) [spring-boot-actuator-1.2.7.RELEASE.jar:1.2.7.RELEASE]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.8.RELEASE.jar:4.1.8.RELEASE]
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.Server.handle(Server.java:499) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.13.v20150730.jar:9.2.13.v20150730]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
  Caused by: org.h2.jdbc.JdbcSQLException: Function "ST_ASGEOJSON" not found; SQL statement:
  select this_.id as id1_3_0_, this_.active as active2_3_0_, this_.address as address3_3_0_, this_.city as city4_3_0_, this_.country_id as country_5_3_0_, this_.date_created as date_cre6_3_0_, this_.deleted as deleted7_3_0_, this_.email as email8_3_0_, this_.giata_id as giata_id9_3_0_, this_.name as name10_3_0_, this_.phone as phone11_3_0_, this_.postcode as postcod12_3_0_, this_.state as state13_3_0_, this_.last_updated as last_up14_3_0_, ST_AsGeoJSON(this_.geom) as formula10_0_ from hotel this_ where this_.id in (?) order by lower(this_.id) asc limit ? [90022-176]
      at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) ~[h2-1.3.176.jar:1.3.176]
  </code></pre>