Seriously, deploying apps to Glassfish couldn't be easier



Here is the SJSAS 8.1 docs on autodeploy and dynamic reloading.  They should work even better in Glassfish/SJSAS 9.0.  But if you don't like reading formal docs, here are the deployment exercises I just did.

First of all, this is where autodeploy and dynamic-reloading are configured.  You can also view and edit them in admingui, usually at https://localhost:4848

$SJSAS_HOME/domains/domain1/config/domain.xml:

<das-config admin-session-timeout-in-minutes="60" autodeploy-dir="${com.sun.aas.instanceRoot}/autodeploy" autodeploy-enabled="true" autodeploy-jsp-precompilation-enabled="false" autodeploy-polling-interval-in-seconds="2" autodeploy-verifier-enabled="false" deploy-xml-validation="full" dynamic-reload-enabled="true" dynamic-reload-poll-interval-in-seconds="2"/>


Autodeploy:  copy foo.war/foo.ear/foo-ejb.jar/foo-application-client.jar (anything that can be legally deployed) to the autodeploy dir, which is typically $SJSAS_HOME/domains/domain1/autodeploy.  If autodeploy succeeds, you will see foo.war_deployed.

Auto-undeploy: delete $SJSAS_HOME/domains/domain1/autodeploy/\*.?ar

Auto-redeploy: recopy to autodeploy dir, or touch $SJSAS_HOME/domains/domain1/autodeploy/\*.?ar

Autodeploy + dynamic-reloading JSP pages: after you autodeploy foo.war, you want to experiment changes in index.jsp.  You can go to $SJSAS_HOME/domains/domain1/applications/j2ee-modules/foo/, edit index.jsp.  When you reload http://localhost:8080/foo/, you will see the new change.

Autodeploy + dynamic-reloading config files: after you autodeploy foo.war, you want to experiment changes in web.xml.  You can go to $SJSAS_HOME/domains/domain1/applications/j2ee-modules/foo, and edit WEB-INF/web.xml.  In foo directory (not WEB-INF), touch a file .reload.  For example, I added a new mapping for index.jsp:

 <servlet>
    <servlet-name>index</servlet-name>
    <jsp-file>/index.jsp</jsp-file>
  </servlet>
  <servlet-mapping>
    <servlet-name>index</servlet-name>
    <url-pattern>/start</url-pattern>
  </servlet-mapping>


When you request http://localhost:8080/foo/start, you will see the response from index.jsp.

asadmin deploydir: with this command you can deploy your apps without packaging them.  For more information, run $SJSAS_HOME/bin/asadmin deploydir --help.  For example:

/ws/sample/hello >
./index.jsp
./WEB-INF/web.xml

/ws/sample/hello >$S1AS_HOME/bin/asadmin deploydir $PWD
Command deploydir executed successfully.


Finally, you can always use the more formal deployment methods with asadmin deploy command and admingui.

You may be interested to know how to write and deploy a simpel webservice app to SJSAS/Glassfish with vi/emacs/notepad and javac

PS: This is a response to this blog:No, seriously. How do you deploy a webapp to Glassfish?

Comments:

hmmm

Posted by guest on July 10, 2008 at 11:49 AM EDT #

why so serious muthafaka

Posted by joker on February 04, 2009 at 04:55 AM EST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Cheng Fang

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today