|
| 1 | +# Glassfish 4.1.1 Basic Operating Notes |
1 | 2 |
|
2 |
| - Date: 10-Jan-2017 |
3 |
| - Subj: Glassfish notes for this operation |
| 3 | +- 2018-08-16 - update |
| 4 | +- 2017-01-10 |
4 | 5 |
|
5 |
| -The ports are adjusted to avoid conflicts with other services |
6 |
| - The settings are in file glassfish4/glassfish/domains/domain1/config/domain.xml |
7 |
| - http-listener-1 8102 |
8 |
| - http-listener-2 8202 |
9 |
| - admin-listener 8343 |
| 6 | +To **change ports**, look for the following, default listener in the settings file **glassfish4/glassfish/domains/domain1/config/domain.xml** |
10 | 7 |
|
11 |
| -to see logs |
12 |
| - tail -f glassfish-8102-4.1.1/glassfish4/glassfish/domains/domain1/logs/server.log |
13 |
| - tail -f glassfish-8102-4.1.1/glassfish4/glassfish/domains/domain1/logs/intmag.log |
| 8 | +- http-listener-1 8102 |
| 9 | +- http-listener-2 8202 |
| 10 | +- admin-listener 8343 |
14 | 11 |
|
15 |
| -to start |
16 |
| - glassfish4/glassfish/bin/asadmin start-domain |
| 12 | +To **start** glassfish, use the following command. |
| 13 | +``` |
| 14 | +glassfish4/glassfish/bin/asadmin start-domain |
| 15 | +``` |
| 16 | +Note: the admin-listener port parameter **-- port 8348** may be needed. i.e. |
| 17 | +``` |
| 18 | +glassfish4/glassfish/bin/asadmin --port 8348 start-domain |
| 19 | +``` |
17 | 20 |
|
18 |
| -to check system properties, wssConfigDir must be correctly set |
19 |
| -note: must use admin-listener port on all admin commands, port: 8343 |
20 |
| - admin user name: admin |
21 |
| - admin pw: cube1iris |
| 21 | +To **stop** |
| 22 | +``` |
| 23 | +glassfish4/glassfish/bin/asadmin stop-domain |
| 24 | +``` |
22 | 25 |
|
23 |
| -to get use a service |
24 |
| - http://cube1:8102/intmag/wssversion |
25 |
| - http://cube1:8102/intmag/v2/swagger |
| 26 | +To specify the WSS configuration file location, the Java property, wssConfigDir must be set explicitly to the path for the cfg files. The cfg files may be located at any convenient path. **to set wssConfigDir** |
| 27 | +``` |
| 28 | +glassfish4/glassfish/bin/asadmin create-system-properties wssConfigDir=$(pwd)/glassfish/domains/domain1/wss_config |
| 29 | +``` |
26 | 30 |
|
27 |
| -to stop |
28 |
| -glassfish4/glassfish/bin/asadmin stop-domain |
| 31 | +Glassfish does not recognize the convention that Tomcat uses to create a context name based on "#" characters in the the war file name. If this does not matter, autodeploy may be used, see discussion below, however, to **deploy with a specific context, like fdsnws/event/1**, the context must be set explicitly with a deploy command: |
| 32 | +``` |
| 33 | +glassfish4/glassfish/bin/asadmin deploy --contextroot fdsnws/event/1 /path/to/webserviceshell-2.4.war |
| 34 | +``` |
29 | 35 |
|
30 |
| -to replace web service, the server usually needs to be shutdown |
31 |
| - - shows up as errors related to stale file |
32 |
| - - it seems to be problem on cube1 where nfs mounts are used to provide the file system |
33 |
| - rm glassfish4/glassfish/domains/domain1/autodeploy/intmag.war |
34 |
| - glassfish4/glassfish/bin/asadmin stop-domain |
35 |
| - rm -rf glassfish4/glassfish/domains/domain1/applications/intmag/ |
36 |
| - glassfish4/glassfish/bin/asadmin start-domain |
37 |
| - cp ~/transient/webserviceshell-2.3.war glassfish4/glassfish/domains/intmag.war |
38 |
| - mv glassfish4/glassfish/domains/intmag.war glassfish4/glassfish/domains/domain1/autodeploy/ |
| 36 | +To **see logs**, check the domain1/logs folder for the server.log and WSS logs |
| 37 | +``` |
| 38 | +tail -f glassfish4/glassfish/domains/domain1/logs/server.log |
| 39 | +tail -f glassfish4/glassfish/domains/domain1/logs/xyz_app.log |
| 40 | +``` |
39 | 41 |
|
| 42 | +**Using autodeploy:** autodeploy works as expected on OS X (excepting not recognizing "#"), but may not work reliably if NFS mounts are used to provide the file system. **Errors related to stale file ...** indicate this problem. **If using autodeploy on an NFS file system**, the following steps for deploying a service called "intmag", may be needed: |
40 | 43 |
|
41 |
| -to install custom log formatter |
42 |
| - cp custom-formatter-1.0-SNAPSHOT.jar glassfish4/glassfish/domains/domain1/lib/ext/ |
43 |
| - edit file glassfish4/glassfish/domains/domain1/config/logging.properties |
44 |
| - update GFFIleHandler.formatter to |
45 |
| - com.sun.enterprise.server.logging.GFFileHandler.formatter=edu.iris.logging.GlassfishCustomFormatter |
46 |
| - see log properties, may need to restart |
47 |
| - glassfish4/glassfish/bin/asadmin --port 8348 restart-domain domain1 |
| 44 | +``` |
| 45 | +# remove war file |
| 46 | +rm glassfish4/glassfish/domains/domain1/autodeploy/intmag.war |
| 47 | +# stop server |
| 48 | +glassfish4/glassfish/bin/asadmin stop-domain |
| 49 | +# remover respective applications folder |
| 50 | +rm -rf glassfish4/glassfish/domains/domain1/applications/intmag/ |
| 51 | +# start server |
| 52 | +glassfish4/glassfish/bin/asadmin start-domain |
| 53 | +# make a copy of war file with appropriate name |
| 54 | +cp ~/transient/webserviceshell-2.3.war glassfish4/glassfish/domains/intmag.war |
| 55 | +# move it into autodeploy folder |
| 56 | +mv glassfish4/glassfish/domains/intmag.war glassfish4/glassfish/domains/domain1/autodeploy/ |
| 57 | +``` |
48 | 58 |
|
49 |
| -to see log properties |
| 59 | +**Optional logger installation:** For extended testing with glassfish, the **default log messages can be very verbose**, an optional custom logger is available called custom-formatter-1.0-SNAPSHOT, **to install a custom log formatter in glassfish**: |
| 60 | + |
| 61 | +- Check log properties before and after changes to verify installation |
| 62 | + ``` |
50 | 63 | glassfish4/glassfish/bin/asadmin --port 8348 list-log-attributes
|
| 64 | + ``` |
| 65 | +- put the formatter jar file in the lib/ext folder |
| 66 | + ``` |
| 67 | + cp custom-formatter-1.0-SNAPSHOT.jar glassfish4/glassfish/domains/domain1/lib/ext/ |
| 68 | + ``` |
| 69 | +- change the configuration |
| 70 | + - ** edit file** glassfish4/glassfish/domains/domain1/config/logging.properties |
| 71 | + - update property **GFFIleHandler.formatter** |
| 72 | + - the full setting is |
| 73 | + **com.sun.enterprise.server.logging.GFFileHandler.formatter=edu.iris.logging.GlassfishCustomFormatter** |
51 | 74 |
|
| 75 | + |
| 76 | +- check log properties, **a restart may be needed** |
| 77 | + ``` |
| 78 | + glassfish4/glassfish/bin/asadmin --port 8348 restart-domain domain1 |
| 79 | + ``` |
0 commit comments