ken
ken

Reputation: 666

grails 3 tomcat war web url context

Is there a how-to explained for grails 3 app run on/in tomcat 8?

Background: | Grails Version: 3.0.9 | Groovy Version: 2.4.5 | JVM Version: 1.8.0_91 Grails application running at http://localhost:8080 in environment: production INFO org.springframework.security.core.SpringSecurityCoreVersion - You are running with Spring Security Core 4.0.3.RELEA

Current steps I'm at now:

  1. grails compile
  2. grails prod war
  3. java -Dgrails.env=prod -jar build/libs/gr-base-0.21.war

This is able to run the app. I'm able

ERROR 1: ```` ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[grailsDispatcherServlet] - Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet'] with root cause javax.servlet.ServletException: Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet'

    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1227) ~[spring-webmvc-4.1.7.R

ELEASE.jar!/:4.1.7.RELEASE]
````

Another error in logs is: ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[grailsDispatcherServlet] - Servlet.service() for servlet grailsDispatcherServlet threw exception javax.servlet.ServletException: Could not resolve view with name '/error' in servlet with name 'grailsDispatcherServlet' I tried setting the context in application.groovy: app.name=livecam grails.app.context = "/livecam"

The static security settings are thus: grails.plugin.springsecurity.controllerAnnotations.staticRules = [ [pattern: '/', access: ['permitAll']], [pattern: '/error', access: ['permitAll']], [pattern: '/index', access: ['permitAll']], [pattern: '/register', access: ['permitAll']], [pattern: '/failed', access: ['permitAll']], [pattern: '/index.gsp', access: ['permitAll']], [pattern: '/shutdown', access: ['permitAll']], [pattern: '/assets/**', access: ['permitAll']], [pattern: '/logout/**', access: ['permitAll']], [pattern: '/login/**', access: ['permitAll']], [pattern: '/**/js/**', access: ['permitAll']], [pattern: '/**/css/**', access: ['permitAll']], [pattern: '/**/images/**', access: ['permitAll']], [pattern: '/appstatus/**', access: ['permitAll']], [pattern: '/appStatus/**', access: ['permitAll']], [pattern: '/stats/**', access: ['permitAll']], [pattern: '/stat/**', access: ['permitAll']], [pattern: '/hello/**', access: ['permitAll']], [pattern: '/index/**', access: ['permitAll']], [pattern: '/testing/**', access: ['permitAll']], [pattern: '/j_spring_security_logout**', access:['permitAll']], [pattern: '/j_spring_security_facebook_redirect**', access: ['permitAll']], [pattern: '//j_spring_security_facebook_json**', access: ['permitAll']], [pattern: '/j_spring_security_facebook_redirect/**', access: ['permitAll']], [pattern: '//j_spring_security_facebook_check/**', access: ['permitAll']], [pattern: '/j_spring_security**', access: ['permitAll']], [pattern: '/**/*.htm*', access: ['permitAll']], [pattern: '/**/favicon.ico', access: ['permitAll']] ] The static security was an update, I suspect the leading /**/ needs to be there! :( Let's hope this is the solution.

Upvotes: 1

Views: 1047

Answers (1)

ken
ken

Reputation: 666

https://github.com/grails/grails-core/issues/9302

getting the search keywords correct is beneficial.

graemerocher commented on Oct 7, 2015 You can workaround the issue by doing cd build/libs and then java -jar app310-0.1.war

Grails gets confused because it thinks you are running the project locally if you run it from the project root. keywords that worked were:

ServletException: Could not resolve view with name '/error' in servlet with name 'grailsDispatcherServlet'

Upvotes: 0

Related Questions