If GlassFish is run as non-root process, with reduced privileges, as recommended, it won't be able to bind to ports < 1024. You'll get an exception:
java.net.BindException: Permission denied: 80 at com.sun.enterprise.web.connector.grizzly.SelectorThread.initEndpoint
To get around this you could set up a domain that has the ability to bind to standard Unix ports, including the port 80. For this you use the --serviceproperties net_privaddr flag of asadmin create-service command.
You can use the following steps. Replace the italic portion with your specific settings.
/opt/gf21/glassfish/bin# ./asadmin create-domain --adminport 4848 --instanceport 80 --profile cluster --user admin --domaindir /opt/gf21/glassfish/domains ptmp
Please enter the admin password>
Please enter the admin password again>
Please enter the master password [Enter to accept the default]:>
Please enter the master password again [Enter to accept the default]:>
Using port 4848 for Admin.
Using port 80 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
On Unix platform, port numbers below 1024 may require special privileges.
Domain being created with profile:cluster, as specified on command line or environment.
Security Store uses: JKS
Domain ptmp created.
You need to create a file with the admin credentials:
cat > /opt/gf21/glassfish/domains/ptmp/.aspass
AS_ADMIN_USER=admin
AS_ADMIN_PASSWORD=something
AS_ADMIN_MASTERPASSWORD=
^D
/opt/gf21/glassfish/bin# ./asadmin create-service --passwordfile /opt/gf21/glassfish/domains/ptmp/.aspass --type das --serviceproperties net_privaddr /opt/gf21/glassfish/domains/ptmp
The Service was created successfully. Here are the details:
Name of the service:application/SUNWappserver/ptmp
Type of the service:Domain
Configuration location of the service:/opt/gf21/glassfish/domains
Manifest file location on the system:/var/svc/manifest/application/SUNWappserver/ptmp_opt_gf21_glassfish_domains/Domain-service-smf.xml.
The service could be enabled using svcadm command.
Command create-service executed successfully.
Ckeck that the newly created service is online.
# svcs -a | grep ptmp
online 14:26:14 svc:/application/SUNWappserver/ptmp:default
If not make it so.
# svcadm enable svc:/application/SUNWappserver/ptmp:default
An extra sanity check:
# netstat -a | grep 80
No comments:
Post a Comment