To install and setup a domain in the Glassfish 2 application server. We can then use this Glassfish server for various java tutorials such as web-services, EJBs and JMS. This covers basic setup and configuration of Glassfish 2. Leave any questions or problems as comments and I will endeavour to answer them.
Assumptions
We assume that the jdk 1.5.0 or compatible version and Ant are already installed.
Versions used in this example
| Software Component | Image |
| Glassfish 2 | glassfish-installer-v2.1-b60e-windows.jar |
| Ant 1.7 | apache-ant-1.7.1-bin.zip |
| JDK 1.5.0 | N/A |
Install/unzip
- Download the image/binary and save it to the directory where you wish to install glassfish. Example C:\Program Files\.
`
- Now open a command prompt and cd into the directory where you saved the file.
`
- Run java -jar to unpack the file. This will create a directory called glassfish.
This will popup a window with the license agreement. Scroll to the end and press Agree. You should see your prompt fill up with files being unpacked.
C:\Program Files>java -jar glassfish-installer-v2.1-b60e-windows.jar
`
- Now cd into the glassfish directory that the previous command created.
`
- Run ant on the setup.xml file. I don't have ant in my path so I'm specifying the full path to my ant executable.
C:\Program Files\glassfish>D:\downloads\apache-ant-1.7.1\bin\ant -f setup.xml
`
- Create a directory called domains under the glassfish directory.
`
- Now cd into the glassfish\asadmin\bin directory,
`
- Run the asadmin create-domain command to create a domain for our applications. I have chosen port 8082 because on conflichs with apache's web-server and tomcat. You can put in whatever you like. This will create a domain1 directory under the domains directory.
Remember the passwords you typed for admin and master password. The name of this domain will be domain1.
...glassfish\bin>asadmin create-domain --adminuser admin --adminport 4848 --instanceport 8082 domain1 - Cd into the domain1\bin directory and run startserver.bat. For admin username type admin and type the passwords you entered when you created the domain.
`
- Check the logfiles at domain1\logs to make sure everything looks ok.
`
- Open a browser and go to http://127.0.0.1:8082. You should see a welcome page.
`
- In the browser type http://127.0.0.1:4848 and login using admin and the password you created. You are now done.
Back to the tutorial trail | Home.
2 comments:
Step7. It should be "glassfish\bin\asadmin"
After stẹp5, setup.xml file created 'domain1' in 'domains' folder. I deleted it and re-created 'domain1' as you say. Is it ok?
i encounter errors in my server logs. what should i do?
Post a Comment