JasperReports Server 4.0 on Glassfish 3.1 / 3.2.1

1. Download JasperReports Server installation package

2. Unzip this package and then following the steps in chapter 5 ‘Installing the War File Distribution’ within JasperReports-Server-CP-Install-Guide.pdf.

3. If you are running Mysql 5.5, then there is an issue posted here

Scroll down the page to ‘5. Known Issues

* 21953: The JasperReports Server repository database has issues under MySQL 5.5. There is a conflict with a new reserved word: MAXVALUE. Also, the storage engine needs to be specified as engine=Innodb (instead of type=Innodb).

In order to use the command ‘maxValue‘, you need to replace with all ‘maxValue‘ lines which exist without quotes to have quotes, so ‘`maxValue`‘ and change any ‘Type=Innodb‘ to ‘ENGINE=Innodb‘, within all the *.ddl files in /jasperreports-server-cp-4.0.0-bin/buildomatic/install_resources/sql/mysql/

4. Now edit the file default_master.properties, add the following settings for glassfish

appServerType = glassfish2
appServerDir =/Glassfish3.1/glassfish

5. edit /jasperreports-server-cp-4.0.0-bin/buildomatic/bin/validation.xml

add following to line 342

<equals arg1="${appServerType}" arg2="glassfish2" />

Before code looks like this:

<if>
<not>
<or>
<equals arg1="${appServerType}" arg2="skipAppServerCheck" />
<equals arg1="${appServerType}" arg2="tomcat5" />
<equals arg1="${appServerType}" arg2="tomcat6" />
<equals arg1="${appServerType}" arg2="jboss" />
</or>
</not>

After you code should look like this, part in bold is the change:

<if>
<not>
<or>
<equals arg1="${appServerType}" arg2="skipAppServerCheck" />
<equals arg1="${appServerType}" arg2="tomcat5" />
<equals arg1="${appServerType}" arg2="tomcat6" />
<equals arg1="${appServerType}" arg2="jboss" />
<equals arg1="${appServerType}" arg2="glassfish2" />

</or>
</not>

Without this the installation script will not continue. This is probably a bug within the system.

6. Manually install data-pooling and data resources required for glassfish,mysql database username and password should be set correctly in js-glassfish-ds.xml :

when glassfish is running, use asadmin add databaseresources.

/usr/local/glassfish3.1/glassfish/bin/asadmin add-resources  /jasperreports-server-cp-4.0.0-bin/buildomatic/build_conf/default/js-glassfish-ds.xml

7.  Comment out the glassfish datasource autoinstallation script.

Edit /jasperreports-server-cp-4.0.0-bin/buildomatic/bin/app-server.xml, comment out the glassfish2 datasources option

Code before the change:


 <if>
          <equals arg1="${appServerType}" arg2="glassfish2" />
          <then>
              <runasadmin>
                  <arg value="start-domain"/>
                  <arg value="domain1"/>
              </runasadmin>
             <runasadmin>
                  <arg value="add-resources"/>
                  <arg value="${currentConf}/js-glassfish-ds.xml"/>
              </runasadmin>
              <runasadmin failOnError="false">
                  <arg value="create-jvm-options"/>
                  <arg value="${glassfishJvmOpt}"/>
              </runasadmin>                  <runasadmin>
                  <arg value="stop-domain"/>
                  <arg value="domain1"/>
              </runasadmin>    

          </then>
      </if>


Code after the rem’d out statement around line 415, Marked in Bold:


 <if>
          <equals arg1="${appServerType}" arg2="glassfish2" />
          <then>
             <!--  <runasadmin>
                  <arg value="start-domain"/>
                  <arg value="domain1"/>
              </runasadmin>
             <runasadmin>
                  <arg value="add-resources"/>
                  <arg value="${currentConf}/js-glassfish-ds.xml"/>
              </runasadmin>
              <runasadmin failOnError="false">
                  <arg value="create-jvm-options"/>
                  <arg value="${glassfishJvmOpt}"/>
              </runasadmin>                  <runasadmin>
                  <arg value="stop-domain"/>
                  <arg value="domain1"/>
              </runasadmin>    -->

          </then>
      </if>
...


8. Stop glassfish and Run the autoinstall command js-install-ce.bat in Windows or js-install-ce.sh in Unix. If you are using MYSQL 5.5 should use minimal argument to avoid default full installation(Default installation comes with sample data and sample table, but will bring sql insert error in MYSQL 5.5  because the java source code still use MaxValue). Use help can get all the functions.

./js-install-ce.sh minimal (unix)

js-install-ce.bat (windows)

9. All the files should then be copy to /glassfish3.1/glassfish/domains/domain1/autodeploy/jasperserver.war/

10. Create a glassfish-web.xml file in /glassfish3.1/glassfish/domains/domain1/autodeploy/jasperserver.war/WEB-INF/

Paste the following information to this file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<resource-ref>
<res-ref-name>jdbc/dataSource</res-ref-name>
<jndi-name>jdbc/jasperserver</jndi-name>
</resource-ref>
<class-loader delegate="true"/>
</glassfish-web-app>

<jndi-name>jdbc/jasperserver</jndi-name>” is required for glassfish3.1, otherwise the server will throw “javax.naming.NameNotFoundException: JasperServerDataBase not found” error message during deploying the web application. This is not necessary for glassfish3.0. The default setting in web.xml can be picked up by glassfish3.0.

11. Restart glassfish3.1. All should now work!

One comment

  1. Pingback: Access JasperReports Server using LDAP « Not so many…

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