1
votes

I'm trying to deploy a Grails 3 app to a Tomcat 8 instance on Elastic Beanstalk and I've tried a few things that I've found on Google and Stack Exchange including changing the "org.springframework.boot:spring-boot-starter-tomcat" dependency from "compile" to "provided," which didn't work. Elastic Beanstalk will accept the war file, but then just shows a blank page.

I opened up the war file that Grails produced and saw that there's no index.jsp file in the base directory or web.xml file under WEB-INF. Both of those exists in a simple war file I made using a Maven web-app archetype, which works, so I have two questions:

1) Has anyone else deployed an app from the latest version of Grails to Tomcat 8? Especially on Elastic Beanstalk and especially recently? Most of the answers I've found from Googling are old, so I'm thinking maybe something has changed with a new version.

2) What's the best reference to see the process Tomcat 8 goes through when opening a WAR file and loading it? I think if I could dig deeper into this process, I could figure out where the missing pieces are.

1
We deploy grails 3 to EB quite a bit, but we just use standalone jar's and the java EB profile.erichelgeson
I found same problem don't know how to make it workDenny
I ended up just reverting back to Grails 2.3.7, which seems to work fine.John Stanford
@JohnStanford , grails v2 is very old , we should move to grails 3.0Denny
@JonhStanford , I successfully deployed to AWS tomcat 8.0 , grails 3.2.3 –Denny

1 Answers

0
votes

@John Stanford , I found same problem my grails version is 3.2.3

I have tested deploy to my tomcat8 on local , and found my data-source configuration cause this problem , my grails app is just dummy app , no need database connection ,

the log /var/lib/tomcat8/logs/catalina.2017-xx-xx.log show as below

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsCacheFilter': Cannot create inner bean '(inner bean)#7cbf54fc' of type [grails.plugin.cache.web.filter.simple.MemoryPageFragmentCachingFilter] while setting bean property 'filter'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#7cbf54fc': Unsatisfied dependency expressed through method 'setUrlMappingsHandlerMapping' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'urlMappingsHandlerMapping': Unsatisfied dependency expressed through method 'setWebRequestInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor': Cannot resolve reference to bean 'hibernateDatastore' while setting bean property 'hibernateDatastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)

so I comment out the production.dataSource.url of application.yml

environments:
    development:
        dataSource:
            dbCreate: create-drop
            url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
    test:
        dataSource:
            dbCreate: update
            url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
    production:
        grails:
            serverURL: http://xxx-evn-yyy-zzzz-aws-zone-2.elasticbeanstalk.com
        dataSource:
            dbCreate: none
            #url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
            properties:
                jmxEnabled: true
                initialSize: 5
                maxActive: 50
                minIdle: 5
                maxIdle: 25
                maxWait: 10000

and finally deploy to AWS Beanstalk and it works !