Posted by: Anil | October 29, 2007

Glassfish Hosting on Solaris

[Update April 9th: This blog entry has been moved to HOWTO_Glassfish.]

In this blog, we’ll show how to setup Glassfish V2 b58g in your v.DS server from Entic.net. This server will be run as root, and listen on port 80 (http) and 443 (https). It’ll also be integrated into Solaris’ SMF, so it can come up on its own at boot.

First, become root. We’ll grab the Glassfish Solaris binaries for x86, from here using wget.

vds13@vds13:~% su -
Password:
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
root@vds13:/#
root@vds13:/# cd /usr/local
root@vds13:/# /opt/csw/bin/wget http://java.net/download/javaee5/v2_branch/promoted/SunOS_X86/glassfish-installer-v2-b58g.jar
...
root@vds13:/usr/local# ls
bin                              lighttpd
etc                              lighttpd-1.4
glassfish-installer-v2-b58g.jar  man
include                          sbin
lib                              share
root@vds13:/usr/local# java -Xmx256m -jar glassfish-installer-v2-b58g.jar
...
root@vds13:/usr/local# cd glassfish
root@vds13:/usr/local/glassfish# chmod -R +x lib/ant/bin
root@vds13:/usr/local/glassfish#

Glassfish binaries are installed in /usr/local/glassfish. Now, edit the setup.xml file. Change the default https.port (from 8181 to 443), and instance.port (from 8080 to 80) properties.

root@vds13:/usr/local/glassfish# vi setup.xml
...

Install the domain. We’ll use the default of domain name of domain1. This domain will be created in /usr/local/glassfish/domains/domain1.

root@vds13:/usr/local/glassfish# chmod 400 setup.xml
root@vds13:/usr/local/glassfish# lib/ant/bin/ant -f setup.xml
...

This version of Glassfish requires the password file for SMF integration. So, here it is. The passwords can be as shown, they are not used.

root@vds13:/usr/local/glassfish# cat > /usr/local/glassfish/passfile
AS_ADMIN_USER=admin
AS_ADMIN_PASSWORD=adminadmin
AS_ADMIN_MASTERPASSWORD=changeit
^D
root@vds13:/usr/local/glassfish# chmod 400 passfile; cat passfile
AS_ADMIN_USER=admin
AS_ADMIN_PASSWORD=adminadmin
AS_ADMIN_MASTERPASSWORD=changeit
root@vds13:/usr/local/glassfish#

Now we create the actual SMF file.

root@vds13:/usr/local/glassfish# bin/asadmin create-service --passwordfile /usr/local/glassfish/passfile --type das --serviceproperties net_privaddr /usr/local/glassfish/domains/domain1
The Service was created successfully. Here are the details:
Name of the service:application/SUNWappserver/domain1
Type of the service:Domain
Configuration location of the service:/usr/local/glassfish/domains
Manifest file location on the system:/var/svc/manifest/application/SUNWappserver/domain1_usr_local_glassfish_domains/Domain-service-smf.xml.
The service could be enabled using svcadm command.
Command create-service executed successfully.

Now to start it up.

root@vds13:/usr/local/glassfish# svcs *SUNWappserver*
STATE          STIME    FMRI
disabled       18:36:09 svc:/application/SUNWappserver/domain1:default
root@vds13:/usr/local/glassfish# svcadm enable svc:/application/SUNWappserver/domain1:default
root@vds13:/usr/local/glassfish# svcs *SUNWappserver*
STATE          STIME    FMRI
online         18:42:21 svc:/application/SUNWappserver/domain1:default
root@vds13:/usr/local/glassfish#

Thats it… and its online!

You can now access the application at http://vds13.entic.net (or https://vds13.entic.net). The admin console can be accessed at http://vds13.entic.net:4848.

Now, lets finalize things and go change the admin password.

root@vds13:/usr/local/glassfish# bin/asadmin change-admin-password Please enter the old admin password>
Please enter the new admin password>
Please enter the new admin password again>
Updated .asadminpass file with new password.
Command change-admin-password executed successfully.
root@vds13:/usr/local/glassfish#
Advertisements

Responses

  1. Anil, what is the minimum entic.net hosting plan (basic, standard, or premium) that you suggest for setting up glassfish as described? I am guessing that one would need at least 512 MB RAM…

  2. Our Standard plan should work with Glassfish, at least thats what some people have been using on our systems. Of course, it depends on the load and the type of application components. I would say about 256mb+ ram.

  3. […] In one of our previous blogs we’ve discussed how to setup Glassfish in your virtual server from Entic.net. In this blog, we’ll discuss why you would want to use […]

  4. Hi, i think you must also provide the domain path to “bin/asadmin create-service –passwordfile /usr/local/glassfish/passfile” command for SMF integration. Without that i get, CLI20 Operand error.

  5. I don’t think that was necessary. Anyhow, the new version of this same document is here:
    http://wiki.entic.net/index.php?title=HOWTO_Glassfish

    The create-service command had less options than what is showed in this blog.

    Hope that helps!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: