So I'm contributing something positive to the community (and not just filing truckloads of bugs), I thought I'd share my deploy script that I use on my Mac:
[code]
# Set the timeout to a really really really high value,
# since deployment of my application invokes Liquibase
# (www.liquibase.org) and its management of the db
# can take a while
export AS_ADMIN_READTIMEOUT=100000
# Start the domain, or harmlessly fail if it's already up:
asadmin start-domain
# Undeploy the old app, including any app-scoped resources:
asadmin undeploy --cascade myapp-1.0-SNAPSHOT
# Deployments seem to go better from a fresh start; I have no idea why:
asadmin stop-domain
# Head off the "Inconsistent module state" bug that crops up from time to time;
# don't know its cause, but this is the fix:
rm -rf /usr/local/glassfish/glassfish/domains/domain1/generated/policy/myapp-1.0-SNAPSHOT
# I'm in development, so I drop and recreate the database each time:
mysql -uroot -ppasswordGoesHere -e 'DROP DATABASE FOO; CREATE DATABASE FOO CHARACTER SET utf8;'
# Bring the domain back up:
asadmin start-domain
# Force a new deployment in case anything went wrong:
asadmin deploy --force ~/Projects/myapp/myapp-ear/target/myapp-1.0-SNAPSHOT.ear
# If you're using a build prior to 3.1b19, then see
https://glassfish.dev.java.net/issues/show_bug.cgi?id=13096 for why we immediately redeploy.
#asadmin undeploy --cascade lead-1.0-SNAPSHOT
#asadmin deploy ~/Projects/lead/lead-ear/target/lead-1.0-SNAPSHOT.ear
# Create some app-scoped resources:
asadmin create-connector-connection-pool --raname=myapp-1.0-SNAPSHOT#foo-drools-rar-1.0-SNAPSHOT --connectiondefinition=org.drools.KnowledgeBase --description "A connector connection pool for the foo-drools-rar resource adapter." foo-drools-connection-pool
asadmin create-connector-resource --poolname foo-drools-connection-pool --description "A connector resource for the foo-drools-connection-pool connection pool." com.foo.bar.BazBean/someField
# All of this takes a good long while so notify me when it's all done:
growlnotify -n glassfish -m 'MyApp successfully deployed'
[/code]
Hope that helps someone.
Best,
Laird
[Message sent by forum member 'ljnelson']
http://forums.java.net/jive/thread.jspa?messageID=482752