Running Glassfish under NetBeans on IS PCs

adorableautomaticΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 4 χρόνια και 11 μήνες)

307 εμφανίσεις

Page 1/2
Copyright © 2010 Aberystwyth University All rights reserved.
Running Glassfish under NetBeans on IS PCs
Users can run the Glassfish 3 application server on Information Services PCs under NetBeans 6.7. This
describes the background to doing this and provides instructions.
1 NetBeans Configuration
NetBeans can be configured, through its normal GUI. Configurations include database management system
links and application server links which are set up and can be browsed in the Services window. These
configurations are stored in a local directory. On IS machines this is D:\xxx_NetBeans where xxx is
the user's ID. A convenient way of working will be to store a copy on this on the M: drive and copy it to
D: before starting NetBeans (copying back to M: at the end of the session if changes have been made -
which is probable). NetBeans will use this, though will create a new one if one does not exist. In this way,
configurations can be saved for use on any machine.
2 Glassfish domains
A site served by Glassfish is stored in a directory. This directory can be anywhere. It is called a domain.
When a Glassfish server starts, it is told which domain to serve.
It is convenient to create a domain outside of NetBeans and then start it from within.
2.1 Creating a Domain
The command line argument for doing this is asadmin. On IS machines, this is not on the standard path
but is found at
C:\Program Files\glassfish-3.0.1\bin
It has many options. asadmin --help will help with these to some extent. The simple answer is:
asadmin create-domain --user xxx --domaindir X:\mydomain --portbase nnn
thedomain
This will create a domain which will answer most needs but which will not be secure (i.e. should not be run
publicly). The values should be as follows:
• xxx is the admin user's name for the domain. Your normal user ID will be appropriate.
• The domaindir argument (X:\mydomain above) is the directory where you want the domain
directory created.
• nnn is the base port number from which the ports on which the server operates are calculated. See
below
.
• The final argument (thedomain above) is the name of the domain. It will also be the name of the
created directory. The command above would create a directory X:\mydomain\thedomain.
You will be prompted for new passwords when this runs. You may provide them or, in line with the
basically insecure domain which you are creating, leave them blank.
Running Glassfish under NetBeans on IS PCs
Page 2/2
Copyright © 2010 Aberystwyth University All rights reserved.
2.2 Where to create the domain
It may be most convenient to create the domain on the M: drive. It can be used from there.
Alternatively, you could create it on the D: drive and remember to copy it back and forth each session.
Remember, on the M: drive it will be available for use by a server running on a CS Unix machine
(NetBeans 6.7.1 is also available there. Don't try running it on both at the same time!).
2.3 Port numbers
Standard HTTP servers are accessed on port 80 by default. Application servers tend to be on other ports.
They in fact use a number of ports. When the domain is created, you will be told which ports. They are
at standard offsets from the base port given to asadmin. Typically, the base port is a round number -
say 9000 - and then the service will be available on 9080 and the administrative console for configuring
the domain will be on 9048. Again, the actual ports will be displayed when the domain is created and the
domain will always be on those ports.
There is no discipline about port usage. On one machine, use of a port by an application is on a first come
first served basis. If you are using an IS PC then nobody else will be in contention and any ports (over
1000) will be ok. If applications do conflict over port usage, you will be told when the second application
starts up.
3 Configuring running a domain
In NetBeans, right mousing Servers in the Services window begins the process of configuring a
domain to run as a development domain under NetBeans. The answers are:
1.
Choose Server. Select Glassfish 3.
2.
Server Location. On IS PCs this is
C:\Program Files\glassfish-3.0.1\
3.
Domain. Enter the pathname of the directory created by asadmin. (Possibly on the M: drive).
This will create an entry under Servers. This is now part of your NetBeans configuration. it is stored in
D:\xxx_NetBeans. If you make your copy of that directory available on the IS machine, you will not
have to set this up again. Right clicking the new entry offers start, stop, restart and other options for the
server. It also offers direct access to the web administration interface.
When you now create a web application under NetBeans, the configuration will ask for a server to deploy it
on (under Server and Settings) and the one you have configured will be available on the pull down
menu for that item.