What is Jetty Grails?
My Grails application states that it is using a server called "Jetty Grails." I always thought Grails ran on Gl开发者_如何学运维assFish; I've never heard of Jetty Grails. Please enlighten me on this matter.
Jetty is lightweight servlet container, that is often used to embed a servlet container within a larger application.
When a Grails app is run in development mode, it runs on Tomcat by default. This default was changed from Jetty to Tomcat some time between version 1.1 and 1.2. You can change the default back to Jetty by installing the Jetty Grails plugin. So if you already have this plugin installed (check application.properties
and BuildConfig.groovy
) or are running an old version of Grails (check application.properties
) this would explain why your application is defaulting to Jetty.
If you run grails war
, it builds a .war file for your Grails app that can be deployed to any servlet container, e.g. Tomcat, Jetty, Glassfish, JBoss, WebLogic, etc.
Jetty is a lightweight servlet/JSP engine that's packaged with Grails. You can certainly run on it, because Grails is built on Groovy, Spring, and Hiberate and does not require the full Java EE stack (no EJBs, no JMS).
A Grails app will certainly run on Glassfish, but the entire Java EE stack is not required. It works because Glassfish has a servlet/JSP engine, too. Tomcat is another possibility; so is Resin. Any compliant servlet/JSP engine will do.
Jetty is a lightweight servlet container that seems to be the most popular choice for Java projects that need an embedded servlet container - like Grails.
While Grails apps certainly can run on Glassfish, including it in the distribution would be pointless bloat, since Grails only requires a Servlet container and doesn't use most of the Java EE features (such as EJBs) that Glassfish implements.
精彩评论