-
Notifications
You must be signed in to change notification settings - Fork 327
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
Grails rest-api application only show directories in war file. #609
Comments
Hello. I've tried to reproduce the issue. I've got same response from Unit. When running as Could you please share more details how you deploy it in Tomcat? It would be nice if you try Jetty too, because Unit is more like Servlet Container than fully featured Java Application Server. |
Grails is based on spring boot and used embed tomcat as starter by default. So it can run in servlet container such as tomcat, jetty, undertow: https://docs.grails.org/latest/guide/deployment.html#deploymentContainer Rename to mkdir webapps
mv build/libs/restPproject-0.1-plain.war webapps/ROOT.war Run in tomcat: docker run --rm -p 8080:8080 -v `pwd`/webapps:/usr/local/tomcat/webapps/ tomcat:9-jre11-openjdk-slim $ curl -s localhost:8080
{"message":"Welcome to Grails!","environment":"production","appversion":"0.1","grailsversion":"5.0.1","appprofile":"rest-api","groovyversion":"3.0.7","jvmversion":"11.0.13","reloadingagentenabled":false,"artefacts":{"controllers":1,"domains":0,"services":0},"controllers":[{"name":"restpproject.ApplicationController","logicalPropertyName":"application"}],"plugins":[{"name":"i18n","version":"5.0.1"},{"name":"jsonView","version":"unspecified"},{"name":"core","version":"5.0.1"},{"name":"dataSource","version":"5.0.1"},{"name":"eventBus","version":"SNAPSHOT"},{"name":"restResponder","version":"5.0.1"},{"name":"codecs","version":"5.0.1"},{"name":"controllers","version":"5.0.1"},{"name":"urlMappings","version":"5.0.1"},{"name":"controllersAsync","version":"SNAPSHOT"},{"name":"domainClass","version":"5.0.1"},{"name":"converters","version":"5.0.1"},{"name":"hibernate","version":"7.1.0"},{"name":"interceptors","version":"5.0.1"},{"name":"services","version":"5.0.1"},{"name":"cache","version":"4.0.3"}]} To deploy under jetty, should change ./gradlew assemble
mv build/libs/restPproject-0.1.war webapps/ROOT.war Run in jetty: docker run --rm -p 8080:8080 -v `pwd`/webapps:/var/lib/jetty/webapps/ jetty:10-jre11-slim Both tomcat and jetty should not run a high version because spring boot only support servlet 4.0: https://docs.spring.io/spring-boot/docs/2.5.x/reference/html/getting-started.html#getting-started.system-requirements |
During investigation 3 issues were found in series:
|
After inspecting the Spring Boot source code I've discovered the way how it detects the development environment (I would say it is annoying to catch this):
So, the development class loader has
|
Hi there. I try to build a Grails rest-api application and deploy to unit, but why only show directories in war ?
Here is what I do:
curl -O https://start.grails.org/restPproject.zip -d profile=rest-api
unzip restPproject.zip ; cd restPproject && chmod +x gradlew && sed -i 's/org.grails.plugins:views-gradle:2.1.0/org.grails.plugins:views-gradle:2.1.1/' build.gradle && ./gradlew assemble
But the result is:
But
java -jar /path/to/my.war
is working, also deploy war to tomcat is also working.What's wrong with me?
The text was updated successfully, but these errors were encountered: