Glassfish 3.1 Application Server

Unknown macro: toctreeview

Installation

http://docs.oracle.com/cd/E18930_01/html/821-2427/toc.html

Simply download package and unzip it

unzip ogs-3.1.2.2.zip -d /opt

Configuration

Changing admin password

After unpacking clean package installation there is no admin password defined

amg@ubuntu-amg:$ /opt/glassfish3/glassfish/bin/asadmin change-admin-password
Enter admin user name [default: admin]>
Enter admin password>
Enter new admin password>
Enter new admin password again>
Command change-admin-password executed successfully.

Setting admin password for automated deployments

amg@ubuntu-amg:$ /opt/glassfish3/glassfish/bin/asadmin login
Enter admin user name [default: admin]>
Enter admin password>
Login information relevant to admin user name [admin]
for host [localhost] and admin port [4848] stored at
[/opt/.asadminpass] successfully.
Make sure that this file remains protected.
Information stored in this file will be used by
asadmin commands to manage the associated domain.
Command login executed successfully.

Now you will be able to deploy applications like:

amg@ubuntu-amg:$ /opt/glassfish3/glassfish/bin/asadmin user admin -W password deploy force /var/lib/jenkins/jobs/xms_deploy/workspace/impl/target/xlcloud-xms.war
Command deploy completed

Configuring Connection Pool

You must add mysql jdbc library to application server classpath in order to make the connection pool working. Copy the jar file to /opt/glassfish3/glassfish/lib directory and restart the application server if it's running.

You can get the mysql.jar from your local maven repository:

${M2_REPO}/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar

After that, in admin console (read this if the admin console is taking too long to load: http://techmythoughts.blogspot.com/2010/08/glassfish-v3-admin-console-taking-too.html):

1. Open JDBC > JDBC Connection Pools
2. New...
3. Edit the following fields:

 

field name

value

Pool Name:xms_CP
Resource Type:javax.sql.DataSource
Database Driver Vendor:MySql

4. Next

5. In "Additional Properties" section (bottom of the screen) leave/set only the following properties (delete others):

key

value

networkProtocoljdbc:mysql
serverNamelocalhost
portNumber3306
databaseNamexms
userxms
passwordxms
SessionVariablesstorage_engine=InnoDB

6. Finish

Configuring Data Source

In admin console:

1. Open JDBC > JDBC Resources
2. New...

3. Edit the following fields:

field name

value

JNDI Name:jdbc/__xms
Pool Name:xms_CP

4. OK

Configuring Connection Pool and Data Source for BDD Tests

In admin console:

1. Open JDBC > JDBC Resources
2. New...

3. Edit the following fields:

field name

value

JNDI Name:jdbc/__xms_test
Pool Name:xms_CP

4. OK

If you would like the tests to use a different database (e.g. xms_test), create a new Connection Pool, similar to the xms_CP and choose it instead of xms_CP.

Configuring JMS Connection Factories

In admin console:

  1. Open JMS Resources > Connection Factories
  2. New...
  3. Edit the following fields:

    field name

    value

    Pool Name:

    jms/xms_ConnectionFactory

    Resource Type:

    javax.jms.QueueConnectionFactory

    Transaction Support:XATransaction
  4. OK

Configuring JMS Destination Resources

In admin console:

  1. Open JMS Resources > Destination Resources
  2. New...
  3. Edit the following fields:

    field name

    value

    JNDI Name:

    jms/stackEventsQueue

     

    Physical Destination Name:

    stackEventsQueue

    Resource Type:javax.jms.Queue
  4. OK
  5. Repeat 1-4 with values:

    field name

    value

    JNDI Name:

    jms/meteringEventsQueue

     

    Physical Destination Name:

    meteringEventsQueue

    Resource Type:javax.jms.Queue

    field name

    value

    JNDI Name:

    jms/projectEventsQueue

     

    Physical Destination Name:

    projectEventsQueue

    Resource Type:javax.jms.Queue

Configuring log4j Logging

1. Create log4j.properties file in GlassFish config directory. For example:

cat /opt/glassfish3/glassfish/config/log4j.properties
log4j.rootLogger=DEBUG, FILE
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=/opt/glassfish3/glassfish/domains/domain1/logs/xlcloud.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d |%t| %-1p [%c] - %m%n
log4j.category.org.apache.commons.beanutils=INFO
log4j.category.org.dozer=INFO

2. Add log4j jar to application server classpath. Copy the jar file to /opt/glassfish3/glassfish/lib directory.

You can get the log4j jar from your local maven repository:
${M2_REPO}/log4j/log4j/1.2.15/log4j-1.2.15.jar

3. Add appropriate line in JVM Setting in GlassFish admin console:

-Dlog4j.configuration=file:///opt/glassfish3/glassfish/config/log4j.properties

4. Restart the application server if it was running.

Upgrading Mojarra

Glassfish 3.1.2 includes Mojarra 2.1.6 which causes some minor bugs (including returning 500 on requesting nonexistent jsf file). To resolve them you should upgrada Mojarra to version 2.1.17.

The needed jar may be downloaded from http://repo1.maven.org/maven2/org/glassfish/javax.faces/2.1.17/javax.faces-2.1.17.jar. You need to download it, copy into glassfish modules directory and update it's timestamp:

cp javax.faces-2.1.17.jar /opt/glassfish3/glassfish/modules/javax.faces.jar
touch /opt/glassfish3/glassfish/modules/javax.faces.jar

GlassFish restart is necessary for the change to take effect.

JVM Settings

Move to Configurations > server-config > JVM Settings > JVM Options

Configure JVM memory settings according to server capacity.

Minimal configuration is:

-Xmx1024m

-XX:MaxPermSize=512m

-XX:PermSize=64m

Connection Pool

Move to Configurations > server-config >  Thread Pools > http-thread-pool

Setup Max Thread Pool Size at least as 50.


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 5.4.6 - Documentation - Legal Notice

Site maintained by