...
sudo apt-get update
udo apt-get install python-software-properties
In order to use add-apt-repository, you need to install python-software-properties
udo add-apt-repository ppa:webupd8team/java
This failed, I had to add the following "apt-get software-properties-common" so that the above command is available
sudo apt-get update
This will ensure the new repo is available to apt-get
sudo apt-get install oracle-java7java8-installer
This will install the java jdk
java -version
Do this to confirm the java version
wget download.java.net/glassfish/4.1.2/release/glassfish-4.1.2.zip
This will download glassfish, after which we will need to extract it
unzip glassfish-4.1.2.zip
If unzip is not available, use "apt-get install unzip" to install it on the machine
unzip glassfish-4.1.2.zip -d /opt
Will extract glassfish to /opt
asadmin start-domain
This should start glassfish and you should see something like
Waiting for domain1 to start ................... Successfully started the domain : domain1 domain Location: /opt/glassfish4/glassfish/domains/domain1 Log File: /opt/glassfish4/glassfish/domains/domain1/logs/server.log Admin Port: 4848 Command start-domain executed successfully.
asadmin enable-secure-admin
You should see something like
Enter admin user name> admin Enter admin password for user "admin"> You must restart all running servers for the change in secure admin to take effect. Command enable-secure-admin executed successfully.
asadmin restart-domain
This will restart the domain so the security constraints take affect
Successfully restarted the domain Command restart-domain executed successfully.
You should be able to visit the server via your browser on port 4848
Info | ||
---|---|---|
| ||
By default glassfish admin password is empty. By default admin is NOT secure and therefore cannot be accessed remotely via a browser, follow the steps below
|
Once glassfish is installed, some things to do (if you want another domain)
- domain1 user/password combination fails so simply create a new domain on the same admin port as domain1, before executing the command below stop domain1
create-domain --adminport 4848 domain2
- Then start domain2
start-domain domain2
- Now enable secure admin for remote access but before you do this each domain must have a password
change-admin-password –user admin –domain_name domain2
- Now enable remote access to the admin port
enable-secure-admin - -host localhost - -port 4848
- Now stop and restart the domain
stop-domain domain2
start-domain domain2
- When you access the server from a remote browser you might confronted with information that you are accessing a server without a valid or untrusted certificate
Running the glassfish image
Because I have created a new domain domain2 in the docker container, it has different admin ports and http ports to domain1. Also, I have created a cluster with 4 server instances, each of these exposing different admin and http ports. You cannot access these ports unless you use the -p option in the docker run command, so I have created this batch file to run the glassfish docker image once it has been fully commissioned and the cluster has been created.