X

News, tips, partners, and perspectives for the Oracle Solaris operating system

GlassFish

Guest Author

Yes, GlassFish is in the IPS repository. However, getting it up and running leaves a lot to be desired. It's generally easier to get it from java.net. But for those of you that want to go the IPS route, here are the steps that worked for me. 

Step 1: Get GlassFish

bleonard@opensolaris:~$ pfexec pkg install glassfishv2
DOWNLOAD PKGS FILES XFER (MB)
Completed 12/12 6363/6363 142.44/142.44
PHASE ACTIONS
Install Phase 7404/7404
PHASE ITEMS
Reading Existing Index 9/9
Indexing Packages 12/12

Step 2: Create a Domain

This is one step that I wish the IPS installer did for us. There are a couple of quirks here. The default domain directory of /var is not writable by my user. I'm not sure what the best practice is here (setting permissions, user/group ownership, etc.), so I'm going to change the configuration to use a different directory. You can do this by changing the AS_DEF_DOMAINS_PATH variable in /usr/appserver/config/asenv.conf to something else. For example:

AS_DEF_DOMAINS_PATH="/export/home/bleonard/appserver/domains"

Also, since this is my development workstation, I'm going to save the master password. Therefore, my command to create the domain looks like the following:

bleonard@opensolaris:~$ asadmin create-domain --user admin --adminport 4848 --savemasterpassword=true domain1
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 default port 8080 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.
Domain being created with profile:developer, as specified by variable AS_ADMIN_PROFILE in configuration file.
Security Store uses: JKS
Domain domain1 created.


Step 3: Start the Domain

bleonard@opensolaris:~$ asadmin start-domain domain1
Starting Domain domain1, please wait.
Log redirected to /export/home/bleonard/appserver/domains/domain1/logs/server.log.
Redirecting output to /export/home/bleonard/appserver/domains/domain1/logs/server.log
Domain domain1 is ready to receive client requests. Additional services are being started in background.
Domain [domain1] is running [Sun Java System Application Server 9.1_01 (build b09d-fcs)] with its configuration and logs at: [/export/home/bleonard/appserver/domains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1 /__wstx-services ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://opensolaris:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

Step 4: Create a SMF Service for the Domain

This is optional, but certainly a nice way to manage the domain. Ideally, the IPS installer would have also handled this for us.

Before we can create the service, we need to store the password information in a file. I created a file called glassfish_password.txt in my home directory containing the following:

AS_ADMIN_USER=admin
AS_ADMIN_PASSWORD=adminadmin
AS_ADMIN_MASTERPASSWORD=changeit

Then I ran the following asadmin command:

bleonard@opensolaris:~$ pfexec asadmin create-service --type das --passwordfile glassfish_password.txt /export/home/bleonard/appserver/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:/export/home/bleonard/appserver/domains
Manifest file location on the system:/var/svc/manifest/application/SUNWappserver/domain1_export_home_bleonard_appserver_domains/Domain-service-smf.xml.
The service could be enabled using svcadm command.
Command create-service executed successfully.

Now you can start the the domain using:
svcadm enable domain1

You can see its status with:

bleonard@opensolaris:~$ svcs -x domain1
svc:/application/SUNWappserver/domain1:default (Appserver Domain Administration Server)
State: online since Wed Feb 11 15:12:46 2009
See: Appserver(1)
See: /var/svc/log/application-SUNWappserver-domain1:default.log
Impact: None.

Join the discussion

Comments ( 8 )
  • Nico Wednesday, February 11, 2009

    Now that's what I call integration! (I'm referring, in particular, to the bit where asadmin creates the SMF service for GlassFish.) Awesome!


  • Ryan Wednesday, February 11, 2009

    Thanks for the tip. I ended up doing something similar, but used NetBeans to create a "personal domain" in /export/home/ryan/apps/glassfishV2/domains

    I would like to see either a link to documentation or an example of what to do for a production environment. For example, lets say I don't want the unix user account it runs as to have regular user permissions, and want to use the /var/appserv/domains directory for my domains. I would also want to secure the text file that contains the password.


  • ludo Wednesday, February 11, 2009

    Hi,

    Not sure on how to create a domain via IPS commands: no more post install steps...or pre remove steps... We could hard code a domain in /var and deliver it via IPS, but I believe that the domain contains machine specific data (on v2, not v3 prelude)...Would need more time to investigate...

    IPS is far from being perfect:

    1/ no native format, so we need to do ugly SVR4

    2/ no install logic (post install scripts)

    3/ No offline repository (a P1 showstopper bug imo)

    4/ No relocatable feature (i.e install a package from pkg.opensolaris.org in my home directory.

    I guess this blog entry is good for documenting what a user has to do. Good to mention SMF creation!

    Also, the IPS NetBeans 6.5 product does not recognize the installation by default, or the domains in /var. In anycase, these domains would not be owned by the IDE user... NetBeans could use some pfexec style (or sudo) way to access the domain, but then there is not clean Java APIs to run processing with pfexec or sudo privileges...


  • DuShiping Sunday, February 22, 2009

    dear sir,I am a postgraduate in JiLin university,JiLin province,China.Now,I want to communicate with you,not the question about the IPS,but the question of the application about one library of unix,Xlibc.for the limitation of the resource of Xlibc in the present in China,so ,I think whether you can provide the some information about the program development with the Xlibc opensolaris-basis. with some or more implementation program example best.thank you!


  • Lorin Monday, March 2, 2009

    Trying opensolaris for the frist time today. Is there anything I should know about to get started?


  • Lorin Monday, March 2, 2009

    How do I uninstall solaris. It can't boot from windows cd. Is there a promp for this?


  • Lorin Monday, March 2, 2009

    I fixed it, Thanks but no thanks, I don't much care for opensolaris, however, I do like openoffice. It's a great program and user friendly. Thanks agian all.


  • Brian Leonard Monday, March 9, 2009

    No, you don't have to create the appserver directory. It is created when 'asadmin create-domain' is run. However, that command only needs to be run when installing GlassFish from IPS. Since you installed GlassFish with NetBeans, the domain should already by created for you. Do you see GlassFish listed in the Services window under Servers?


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services