[fleXive] installation guide for Glassfish 2 and 3

Notes for Glassfish 3+: The glassfish base directory is actually the glassfish subdirectory in the installation directory. For example, instead of ${glassfish.home}/domains/domain1 you would need to go to ${glassfish.home}/glassfish/domains/domain1. You can also skip the following section about required libraries if you intend to do only WAR deployments.

Flexive needs several libraries to be deployed to the application server's internal lib directories. Execute these steps once glassfish has been setup.

To set up the databases, follow these instructions.

Setting up Glassfish

  1. Go to the target installation directory

  2. java -Xmx256m -jar <<path-to-downloaded-jar>> extracts the installation JAR to ./glassfish

  3. cd glassfish

  4. On Unix: chmod -R +x lib/ant/bin

  5. Execute the setup.xml buildfile

    • Unix: lib/ant/bin/ant -f setup.xml

    • Windows: lib\ant\bin\ant -f setup.xml

Starting Glassfish

Additional information

  1. To stop the Glassfish instance execute ${glassfish.home}/bin/asadmin stop-domain domain1

  2. Admin UI Port: 4848

  3. HTTP Port: 8080

  4. HTTPS Port: 8181

Three connection pools, two for the division (transactional and non-transactional) and one for the configuration database, have to be set up.

For MySQL copy and paste the following data-source definitions to a file (e.g. flexive-ds.xml) and update your database connection settings:

                <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "sun-resources_1_3.dtd">
<resources>
    <!--
        Glassfish MySQL datasource configuration

        To add these datasource, start Glassfish v2, and execute
        ${glassfish.home}/bin/asadmin add-resources /path/to/flexive-mysql-ds.xml

        Please make sure mysql-connector-java-<version>-bin.jar is located in /domains/domain1/lib/ext (adapt the path to match your domain)
    -->

    <!-- Configure the global configuration datasource -->
    
    <jdbc-connection-pool
        name="flexiveConfiguration"
        datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
        res-type="javax.sql.XADataSource"
		non-transactional-connections="false">
        <property name="user" value="root"/>
        <property name="password" value="a"/>
        <property name="url" value="jdbc:mysql://localhost:3306/flexiveConfiguration?useUnicode=true&amp;characterEncoding=utf8&amp;characterResultSets=utf8"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveConfiguration" jndi-name="jdbc/flexiveConfiguration" enabled="true" object-type="user"/>


    <!-- Configure the first flexive division -->

    <jdbc-connection-pool
        name="flexiveDivision1"
        datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
        res-type="javax.sql.XADataSource"
		non-transactional-connections="false">
        <property name="user" value="root"/>
        <property name="password" value="a"/>
        <property name="url" value="jdbc:mysql://localhost:3306/flexive?useUnicode=true&amp;characterEncoding=utf8&amp;characterResultSets=utf8"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveDivision1" jndi-name="jdbc/flexiveDivision1" enabled="true" object-type="user"/>

    <!-- Configure the first flexive division non-XA datasource -->

    <jdbc-connection-pool
        name="flexiveDivision1NoTX"
        datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
        res-type="javax.sql.DataSource"
		non-transactional-connections="true">
        <property name="user" value="root"/>
        <property name="password" value="a"/>
        <property name="url" value="jdbc:mysql://localhost:3306/flexive?useUnicode=true&amp;characterEncoding=utf8&amp;characterResultSets=utf8"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveDivision1NoTX" jndi-name="jdbc/flexiveDivision1NoTX" enabled="true" object-type="user"/>

</resources>
            

Respectively apply these settings for H2:

                <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "sun-resources_1_3.dtd">
<resources>
    <!--
        Glassfish H2 datasource configuration

        To add these datasource, start Glassfish v2, and execute
        ${glassfish.home}/bin/asadmin add-resources /path/to/flexive-h2-ds.xml

        Please make sure h2.jar is located in /domains/domain1/lib/ext (adapt the path to match your domain)
    -->

    <!-- Configure the global configuration datasource -->
    
    <jdbc-connection-pool
        name="flexiveConfiguration"
        datasource-classname="org.h2.jdbcx.JdbcDataSource"
        res-type="javax.sql.XADataSource"
		non-transactional-connections="false">
        <property name="user" value="sa"/>
        <property name="password" value="()"/>
        <property name="url" value="jdbc:h2:tcp://localhost:9092/~/flexiveConfiguration;MVCC=TRUE"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveConfiguration" jndi-name="jdbc/flexiveConfiguration" enabled="true" object-type="user"/>


    <!-- Configure the first flexive division -->

    <jdbc-connection-pool
        name="flexiveDivision1"
        datasource-classname="org.h2.jdbcx.JdbcDataSource"
        res-type="javax.sql.XADataSource"
		non-transactional-connections="false">
        <property name="user" value="sa"/>
        <property name="password" value="()"/>
        <property name="url" value="jdbc:h2:tcp://localhost:9092/~/flexive;SCHEMA=flexive;MVCC=TRUE;LOCK_TIMEOUT=10000"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveDivision1" jndi-name="jdbc/flexiveDivision1" enabled="true" object-type="user"/>

    <!-- Configure the first flexive division non-XA datasource -->
    <jdbc-connection-pool
        name="flexiveDivision1NoTX"
        datasource-classname="org.h2.jdbcx.JdbcDataSource"
        res-type="javax.sql.DataSource"
		non-transactional-connections="true">
        <property name="user" value="sa"/>
        <property name="password" value="()"/>
        <property name="url" value="jdbc:h2:tcp://localhost:9092/~/flexive;SCHEMA=flexive;MVCC=TRUE;LOCK_TIMEOUT=10000"/>
    </jdbc-connection-pool>

    <jdbc-resource pool-name="flexiveDivision1NoTX" jndi-name="jdbc/flexiveDivision1NoTX" enabled="true" object-type="user"/>

</resources>
            

While Glassfish is running, execute ${glassfish.home}/bin/asadmin add-resources /path/to/flexive-ds.xml to create the connection pools and JDBC resources for MySQL or ${glassfish.home}/bin/asadmin add-resources /path/to/flexive-h2-ds.xml if you are using the H2 database. You have to pass the absolute path to your XML file, otherwise Glassfish looks in its own config directory.

Should you need to edit or reset your datasources, you can do so in the Glassfish administration console under ResourcesJDBC.

Change to the flexive-dist directory of your [fleXive] distribution and run ant ear. This will create the flexive.ear file inside the flexive-dist directory.

Using the autodeploy directory:

  1. Copy the flexive.ear to ${glassfish.home}/domains/domain1/autodeploy

Using the Admin UI:

  1. In the Admin Console, go to ApplicationsEnterprise Applications

  2. Click Deploy... and upload the flexive.ear file.

  3. Click OK

To access the administration GUI point your browser to http://localhost:8080/flexive/adm/ Alternatively you can specify your server's IP address, which is supported by default, too. The default superuser's username and password for the administration GUI are username: supervisor, password: supervisor.