I upgraded my grails application from 5.2 to 6.2.3...
# questions
r
I upgraded my grails application from 5.2 to 6.2.3 and everything works great when I run it locally via bootRun in Intellij. When I deploy to a container and run the built jar my .gson views are not found. Has anyone else had a similar issue? (note that our deployment/run method has not changed with the upgrade..it seems like the gson views are either not present in the jar file and/or not compiled properly).
j
i would suggest extracting the jar files and making sure its not present or check they are in the same location as a first step
r
I've done that actually, but am a little unsure about what I'm looking at. I see that the 5.2 jar file had compiled classes for the gson files in the classes directory. The 6.2 does not. I've gone down several rat-holes trying to rearrange where the .gson files appear in the jar file and also trying to get the gson views to compile beforehand but to no success.
The 6.2 file DOES have the .gson files where I'd expect them to be (and I've copied them to other places in the jar as well). Just no compiled gson class files in the new jar
a
We have working gson views in our 6.2.3 app and also deploy a jar file. The only thing I see in my build.gradle that caught my attention is the code below. I would also recommend running ./gradlew assemble and then running the artifact from build/libs folder with the java -jar command. Are you seeing any errors being logged? tasks.withType(Jar) { dependsOn compileGroovyPages zip64 = true duplicatesStrategy = DuplicatesStrategy.EXCLUDE }
r
Thanks for replying - I tried adding your tasks.withType... block above but it didn't appear to change anything (the jar file size was unaffected). It did not fix the issue - which does not provide any error aside from the stack dump where it complains about not being able to find the gson file:
org.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Unable to load template for uri [/gson/_docketList]. Template not found.
g
I remember i had this issue long time back, but I really could not recall how did I fix it first when I rendered it , I always use the full path(not relative path from the root context). Say render view: ’/my_app/the_gson_view/my_first_level_gson, Then inside gson, when I tried to render a template: tmpl “/my_app/the_gson_view/my_first_level_gson/second_level_template/tmp1” (var: ‘theNamedVariable’, realVariable)
j
it sounds like the classes not being included are the cause of why it's not working. I significantly changed the way the build process worked in 7 due to several issues, unfortunately, i don't remember that being one of the issues. If you try the 7.0.0-M5 release, does it work?
r
Trying 7.0 was next on my list
g
but eventually I moved to single war file, I think there is nothing a single embedded server could not resolve
j
it would be good to know if it doesn't work in 7 , but i think it will
r
I do think one or two of my gson files ARE working (after doing some more testing)...so I wonder if it's a full path thing
I tried a very example app in 6.2.3 with GSON and it did work
👍 1