Search code examples
ubuntutomcatgrailsspring-bootgrails3.2.0

Cannot deploy grails 3 war in Tomcat 7 and Ubuntu - 404 error


I was working with grails 2.4.7 .Now i switched to grails 3.2.3 .I'm trying to deploy my project war file in tomcat7 in ubuntu server.I got 404 error.I added all possible plugins including this

   provided "org.springframework.boot:spring-boot-starter-tomcat" 

After fed up i build war with ROOT name but still has same problem.Can any one give me some possible solution .Here is my application.yml code.

environments:
    development:
        grails:
            serverURL: http://localhost:8080
        dataSource:
            dbCreate: create
            url: jdbc:mysql://localhost/somedb
            username: ****
            password:
            dialect: org.hibernate.dialect.MySQL5InnoDBDialect
            #url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
    test:
        grails:
            serverURL: http://localhost:8080
        dataSource:
            dbCreate: update
            url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
    production:
        grails:
            serverURL: http://ipaddress:8080
        dataSource:
            dbCreate: create
            url: jdbc:mysql://localhost/somedb
            username: *****
            password: *******
            dialect: org.hibernate.dialect.MySQL5InnoDBDialect
           # 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
                maxAge: 600000
                timeBetweenEvictionRunsMillis: 5000
                minEvictableIdleTimeMillis: 60000
                validationQuery: SELECT 1
                validationQueryTimeout: 3
                validationInterval: 15000
                testOnBorrow: true
                testWhileIdle: true
                testOnReturn: false
                jdbcInterceptors: ConnectionState
                defaultTransactionIsolation: 2 

Solution

  • You are probably missing the following in your build.gradle file:

    ext['tomcat.version'] = '7.0.54'
    

    Replace the version number with the Tomcat version you are using.

    Grails 3 works with Tomcat 8 out of the box, you need to specify the Tomcat version in the build.gradle file for it to work with Tomcat 7.

    Refer to Deploying an application for more details.