Recently Guillaume reported to me about his Grail app not deploying on GlassFish v3 Preview 2. The problem reported was that the Grail app was taking lots of time to deploy on GlassFish v3 Preview 2. Although such failures are not acceptable but considering GlassFish v3 is a complete new architecture, is still under development and feature incomplete and above all the preview releases do not go thru the normal test cycle so such bugs can appear.
This issue was discussed at the GlassFish mailing list, see the discussion here and the corresponding bug.
The good news is that Jerome quickly found out what the problem was and after the code went thru reviews, it was checked in and the fix went into yesterday's nightly build.
Here is how I created and deployed a Grails application on GlassFish v3:
Create a simple Grails app
Setup Grails This is the standard way you would setup the Grails environments:
export PATH=$GRAILS_HOME/bin:$PATH
export GRAILS_HOME=/tools/grails
Create a simple Grails app
vivekmz@boson(555)> grails create-app MyFirstGrailsApp
Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /tools/grails
Base Directory: /ws/sb
Environment set to development
Note: No plugin scripts found
Running script /tools/grails/scripts/CreateApp.groovy
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src/java
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src/groovy
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/controllers
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/services
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/domain
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/taglib
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/utils
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/views
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/views/layouts
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/i18n
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test/unit
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test/integration
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/scripts
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/js
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/css
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/images
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/META-INF
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/lib
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf/spring
[mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf/hibernate
[propertyfile] Creating new property file:
/ws/sb/MyFirstGrailsApp/application.properties
[copy] Copying 2 files to /ws/sb/MyFirstGrailsApp
[copy] Copying 2 files to /ws/sb/MyFirstGrailsApp/web-app/WEB-INF
[copy] Copying 5 files to /ws/sb/MyFirstGrailsApp/web-app/WEB-INF/tld
[copy] Copying 87 files to /ws/sb/MyFirstGrailsApp/web-app
[copy] Copying 17 files to /ws/sb/MyFirstGrailsApp/grails-app
[copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
[copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
[copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
[propertyfile] Updating property file:
/ws/sb/MyFirstGrailsApp/application.properties
Created Grails Application at /ws/sb/MyFirstGrailsApp
Start GlassFish v3
vivekmz@boson(735)> glassfish/bin/asadmin start-domain
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: HK2 initialized in 281 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.naming.impl.ServicesHookup@51b48197 Init done in 307 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@9c0ec97 Init done in 310 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.server.SystemTasks@1fd0fafc Init done in 382 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.LogManagerService@388ee016 Init done in 411 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.HouseKeeper@a210b5b Init done in 413 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 8080
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 8181
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 4848
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@506f9b8e startup done in 630 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.security.SecurityServicesUtil@585976c2 startup done in 732 ms
Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 733 ms
You can see above it took 733ms to boot up!
Deploy the Grails App
Now that I have built
MyFirstGrailsApp, it is time to deploy. So first I will create a war file:
vivekmz@boson(558)> cd MyFirstGrailsApp/
vivekmz@boson(559)> grails war
Now Let's deploy to GlassFish v3:
vivekmz@boson(749)> ../glassfish/bin/asadmin deploy MyFirstGrailsApp-0.1.war
SUCCESS : MyFirstGrailsApp-0.1 deployed successfully
properties=(name=MyFirstGrailsApp-0.1)
The server log tells, it took about 9.7 seconds to deploy it:
[#|2008-03-07T20:19:03.580+0000|INFO|GlassFish10.0|javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Thread-4;|Deployment of MyFirstGrailsApp-0.1 done is 9765 ms|#]
Now when I accessing http://localhost:8080/MyFirstGrailsApp-0.1/ my Grails app appears in the Firefox:
GlassFish v3 has been going thru continuous improvements and the development team is busy making it rock solid while adding new features to it. Continue sending your feedbacks to
users@glassfish.dev.java.net.
凡是有该标志的文章,都是该blog博主Caoer(草儿)原创,凡是索引、收藏
、转载请注明来处和原文作者。非常感谢。