Can't resolve view name

117 views
Skip to first unread message

Bobby Warner

unread,
Mar 12, 2015, 12:52:48 PM3/12/15
to grails-de...@googlegroups.com

This isn't a bug with Grails as everything works fine on my Mac, but rather just a question (that I'm sure others will encounter too) I have in regards to running Grails 3 Jars on CentOS.

gvm use grails 3.0.0.RC1
grails create-app foobar
grails package
java -jar build/libs/foobar-0.1.jar

This works great on my Mac with Java 8.  However, when I run the exact same Jar (upload and run java -jar foobar-0.1.jar) on a fresh CentOS 7 box with Java 8, the app starts up fine, but always encounters this error when trying to hit the app in the browser:

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

I've tried creating controllers/views too and the same exception happens.  I can run a regular Spring Boot app with "java -jar" with no problems on the same Centos box.  I assuming I will need to change something in how Grails 3 runs these Jars with Tomcat embedded compared to Spring Boot, but not sure exactly where to start.  Please let me know if you have any thoughts as to how I could fix this in Grails 3.


Thanks,
Bobby

Eric Helgeson

unread,
Mar 15, 2015, 10:46:40 PM3/15/15
to grails-de...@googlegroups.com
I was able to reproduce this issue as well coping the jar to any other machine and any other platform than what it was built on.

I built the jar the same way (on a Mac) and copied it to another Mac, Windows 7, CentOS 6 and 7, and all gave an error running it. Though running the same jar where it was built did not. (all on java 8). Also verified going from centos6 to mac, same issue.

Running `java -jar foobar-0.1.war` worked on different platforms, which is odd since I would think the war would not include any tomcat libs.

Also it looks like users are giving multiple ways to package, `grails package`, `gradle war`, `gradle jar`, `gradle bootRepackage`. This may be confusing to a new user since grails create app doesnt create a ./grailsw (so sharing the code base with other users would only see ./gradlew and those tasks).

Oddly trying ./gradlew bootRepackage it DOES produce a jar that would runs on systems other than the one it was built on.

Finally I did get 1 jar to work across machines but assets did not work (css/img/js), though I didn't change anything (using grails package) and am unable to reproduce.

Diff of unziped jar/war:
$ diff -rt jar war
Only in jar: BootStrap$_closure1.class
Only in jar: BootStrap$_closure2.class
Only in jar: BootStrap.class
diff -rt jar/META-INF/MANIFEST.MF war/META-INF/MANIFEST.MF
4c4
< Main-Class: org.springframework.boot.loader.JarLauncher
---
> Main-Class: org.springframework.boot.loader.WarLauncher
Only in jar: UrlMappings$__clinit__closure1$_closure2$_closure3.class
Only in jar: UrlMappings$__clinit__closure1$_closure2.class
Only in jar: UrlMappings$__clinit__closure1.class
Only in jar: UrlMappings.class
Only in war: WEB-INF
Only in jar: application.yml
Only in war: assets
Only in jar: error.gsp
Only in jar: index.gsp
Only in jar: layouts
Only in jar: lib
Only in jar: logback.groovy
Only in jar: messages.properties
Only in jar: messages_cs_CZ.properties
Only in jar: messages_da.properties
Only in jar: messages_de.properties
Only in jar: messages_es.properties
Only in jar: messages_fr.properties
Only in jar: messages_it.properties
Only in jar: messages_ja.properties
Only in jar: messages_nb.properties
Only in jar: messages_nl.properties
Only in jar: messages_pl.properties
Only in jar: messages_pt_BR.properties
Only in jar: messages_pt_PT.properties
Only in jar: messages_ru.properties
Only in jar: messages_sv.properties
Only in jar: messages_th.properties
Only in jar: messages_zh_CN.properties
Only in jar: notFound.gsp
Only in jar: spring
Only in jar: testapp

Graeme Rocher

unread,
Mar 16, 2015, 3:19:04 AM3/16/15
to grails-de...@googlegroups.com
Please report an issue with steps to reproduce 
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/d3a6137c-3919-497c-8e3e-5c9196b6ddcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Graeme Rocher

Reply all
Reply to author
Forward
0 new messages