Skip to content

Commit 13fcf72

Browse files
author
Peter Pilgrim
committed
Update to code. Is there way to create JMS resource dynamically with a managed Glassfish server? No. The only way is to manually administer GlassFish with the required JMS resources at the command line or use the Admin UI web interface.
1 parent 02ff23e commit 13fcf72

2 files changed

Lines changed: 122 additions & 0 deletions

File tree

ch09/jms-async/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,59 @@ Change the location to the installation root of GlassFish 4.0 on your workstatio
2020
```
2121

2222

23+
## Creating JMS Resources on GlassFish
24+
25+
Open a terminal window.
26+
27+
Navigate to GLASSFISH_HOME and then to the `bin` directory.
28+
29+
```
30+
cd /Library/opt/glassfish-4.1/bin
31+
```
32+
33+
Run the GlassFish administrator program `asadmin`.
34+
35+
At the interactive prompt for this program, run the following commands.
36+
37+
Start the application server on domain1.
38+
```
39+
start-domain
40+
```
41+
42+
Show the running domains
43+
```
44+
list-domains
45+
```
46+
47+
Create the JMS connection factory
48+
49+
```
50+
create-jms-resource --restype javax.jms.ConnectionFactory jms/demoConnectionFactory
51+
```
52+
53+
Create the JMS queue
54+
```
55+
create-jms-resource --restype javax.jms.Queue jms/demoQueue
56+
```
57+
58+
Reveal the JMS resources for this domain1
59+
```
60+
list-jms-resources
61+
```
62+
63+
Stop the application server on domain1
64+
65+
```
66+
stop-domain
67+
```
68+
69+
Terminate the interactive GlassFish Administrator shell and return to the parent command shell prompt.
70+
71+
```
72+
exit
73+
```
74+
75+
2376
+PP+ *2014*
2477

2578

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
3+
SysError () {
4+
echo "$mynamne :: *ERROR* : $*" 1>&2
5+
exit 1
6+
}
7+
8+
myname=`basename $0`
9+
10+
: ${GLASSFISH_HOME:=/Library/opt/glassfish/glassfish-4.1/}
11+
12+
echo "GLASSFISH_HOME=${GLASSFISH_HOME}"
13+
14+
if [ ! -e ${GLASSFISH_HOME} ]; then
15+
SysError "GlassFish directory: $GLASSFISH_HOME does not exist."
16+
fi
17+
if [ ! -d ${GLASSFISH_HOME} ]; then
18+
SysError "GlassFish directory: $GLASSFISH_HOME is not a directory."
19+
fi
20+
21+
BinDir=$GLASSFISH_HOME/bin
22+
23+
if [ ! -d ${BinDir} ]; then
24+
SysError "GlassFish directory: ${BinDir} is not a directory."
25+
fi
26+
27+
28+
${BinDir}/asadmin start-domain
29+
30+
${BinDir}/asadmin list-domain
31+
32+
${BinDir}/asadmin create-jms-resource --restype javax.jms.ConnectionFactory jms/demoConnectionFactory
33+
34+
${BinDir}/asadmin create-jms-resource --restype javax.jms.Queue jms/demoQueue
35+
36+
${BinDir}/asadmin list-jms-resources
37+
38+
${BinDir}/asadmin stop-domain
39+
40+
${BinDir}/asadmin list-domain
41+
42+
43+
#MqProgramDir=$GLASSFISH_HOME/mq/bin
44+
#
45+
#if [ ! -d ${MqProgramDir} ]; then
46+
# SysError "GlassFish directory: ${MqProgramDir} is not a directory."
47+
#fi
48+
#
49+
#${MqProgramDir}/imqobjmgr \
50+
# -l "cn=demoQueue" \
51+
# -j "java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory" \
52+
# -t qf \
53+
# -o "imqAddressList=mq://localhost:7272/jms"
54+
#
55+
56+
#${MqProgramDir}/imqobjmgr \
57+
# -l "cn=demoQueue" \
58+
# -j "java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory" \
59+
# -j "java.naming.provider.url=ldap://localhost:389/o=imq" \
60+
# -j "java.naming.security.principal=uid=homerSimpson,ou=People,o=imq" \
61+
# -j "java.naming.security.credentials=doh" \
62+
# -j "java.naming.security.authentication=simple" \
63+
# -t qf \
64+
# -o "imqAddressList=mq://localhost:7272/jms"
65+
66+
67+
68+
# End
69+

0 commit comments

Comments
 (0)