Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to found gsp page after upgrade to grails 6 #13202

Open
rlconst opened this issue Nov 6, 2023 · 8 comments
Open

Failing to found gsp page after upgrade to grails 6 #13202

rlconst opened this issue Nov 6, 2023 · 8 comments

Comments

@rlconst
Copy link

rlconst commented Nov 6, 2023

Expected Behavior

Exactly the same as #11421. It works locally via gradle bootRun but failed to run via tomcat.

Controllers return json works as expected

I migrated according to https://docs.grails.org/latest/guide/upgrading.html

Also checked that gsp pages are in war archive

Put trace level logging and nothing interesting around page opening

2023-11-06 08:50:07.556 DEBUG --- [nio-8080-exec-7] o.g.w.mapping.DefaultUrlMappingsHolder   : Matched URI [/test/index] with pattern [/(*)/(*)?/(*)?(.(*))?], adding to posibilities
javax.servlet.ServletException: Could not resolve view with name '/error/error' in servlet with name 'grailsDispatcherServlet'
	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1385)
	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1150)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
	org.springframework.boot.web.servlet.support.ErrorPageFilter.forwardToErrorPage(ErrorPageFilter.java:191)
	org.springframework.boot.web.servlet.support.ErrorPageFilter.handleException(ErrorPageFilter.java:176)
	org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:143)
	org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:64)
	org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:101)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:119)
	org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)

Actual Behaviour

No response

Steps To Reproduce

No response

Environment Information

  • tomcat:9.0.82-jdk17-corretto-al2

Example Application

No response

Version

6.1.0

@puneetbehl
Copy link
Contributor

Please share a sample application

@aulea
Copy link
Contributor

aulea commented Nov 8, 2023

i had to explicitly say in gradle package tasks (war/bootJar) to compile gsp pages:

bootJar {
    dependsOn compileGroovyPages
war {
    dependsOn compileGroovyPages

You could open your built package and see, if you have there gsp files or compiled classes from them.

@puneetbehl
Copy link
Contributor

Ideally, it should be automatically configured from the GroovyPagePlugin. See https://github.com/grails/grails-gradle-plugin/blob/6.1.x/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPagePlugin.groovy#L88

@rlconst
Copy link
Author

rlconst commented Nov 9, 2023

@puneetbehl you wouldn't believe but adding explicit dependency helped. Kudos to @aulea

war {
    zip64 = true
    dependsOn compileGroovyPages
}

Should I re-open this problem in grails-gradle-plugin repo or just close?

PS @aulea before the fix I checked war file and saw compiled gsp classes too.

@puneetbehl
Copy link
Contributor

Let keep this ticket open for now. I will take it from here. Thanks!

@codeconsole
Copy link
Contributor

codeconsole commented Nov 12, 2023

Does your settings.gradle point to 6.1.0 ?

https://github.com/codeconsole/website/blob/55be4c246a163986c8451f63e41c484d82675d0a/settings.gradle#L9-L10

pluginManagement {
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core/" }
        gradlePluginPortal()
    }
    plugins {
        id "org.grails.grails-web" version "6.1.0"
        id "org.grails.grails-gsp" version "6.1.0"
        id "com.bertramlabs.asset-pipeline" version "4.3.0"
        id "com.github.erdi.webdriver-binaries" version "3.0"
    }
}

@rlconst
Copy link
Author

rlconst commented Nov 15, 2023

@codeconsole sure. I use kts version

pluginManagement {
  repositories {
    mavenLocal()
    maven { url = uri("https://repo.grails.org/grails/core/") }
    gradlePluginPortal()
  }
  plugins {
    id("org.grails.grails-web") version "6.1.0"
    id("org.grails.grails-gsp") version "6.1.0"
    id("com.bertramlabs.asset-pipeline") version "4.3.0"
    id("com.github.erdi.webdriver-binaries") version "3.0"
  }
}

@codeconsole
Copy link
Contributor

Related outstanding issue in 6.1.0:
grails/grails-gradle-plugin#257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants