JasperServer Installation on Linux

Category: 

This documents updated for JasperServer version 3.0.0

What is JasperServer

JasperServer is an open source business intelligence suite, built by the developers of JasperReports. It providing common services like security and metadata management, and the capability to easily add additional functionality.It also provides a Web and Web services based environment for reporting, data analysis (OLAP), and data integration.

What is JasperReports

JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files. It is entirely written in Java and can be used in a variety of Java enabled applications, including J2EE or Web applications, to generate dynamic content. Its main purpose is to help creating page oriented, ready to print documents in a simple and flexible manner.

System requirements

In order to install JasperServer, you need to setup and configure the following application.

  • Apache Tomcat (with JDK1.6) - to be use as Java container
  • PostgreSQL - to be use to store JasperServer metadata files

Note: You may use JBoss and MySQL as an alternative to the above application.

How to install JasperServer?

JasperServer installation is very easy as no complicated process involved. In this guide, we will use the stand-alone WAR file distribution. Follow the step-by-step below to complete the installation.

A. Download and Unpack JasperServer file

The WAR file distribution comes in a ZIP file format. Please download the file from www.jasperforge.com. Once you have downloaded the WAR file distribution, you need to unpack it in order to access the contained files. Go to any working directory location to unpack the ZIP file.

user@server:~# unzip jasperserver-3.0-bin.zip
user@server:~# ls
docs  jasperserver.war  js-installer-version.txt  license.txt  releaseNotes.txt  samples  scripts

B. Setup the JasperServer database

  • Connect to the PostgreSQL database and create a user for JasperServer. In this document, we will use jasperadmin.
    postgres> CREATE USER jasperadmin PASSWORD '<password>';
  • Create a database for JasperServer with jasperadmin as owner and UTF-8 encoding
    postgres> CREATE DATABASE prd_jasperserver OWNER jasperadmin ENCODING 'UTF-8';
  • Connect to the JasperServer database
    postgres> \c prd_jasperserver
    prd_jasperserver>
  • Create schema for main JasperServer tables. If you already have the database dump, please skip the steps below.
    prd_jasperserver> \i js-create-schema.sql
  • Create default security.
    prd_jasperserver> \i js-create-default-security.sql
  • Create trigger to delete the BLOB data if the reference records is deleted.
    prd_jasperserver> \i js-create-trigger.sql

C. Install/Deploy JasperServer into Tomcat

Because the JasperServer is stand-alone JSP files, the installation process involves dropping the files into the webapps directory of the Tomcat server. If you decided to use Jasper Server as default page, then you should put the files into ROOT directory.

user@server:~# cd $TOMCAT_ROOT/webapps
user@server:~# mkdir jasperserver
user@server:~# cd jasperserver/
user@server:~# jar xvf /home/user/jasperserver.war
user@server:~# ls
cal  externalResource.htm  images  index.htm  inputControl.htm  jpivot  META-INF  scripts  stylesheets  wcf  WEB-INF

Allocate static memory for Tomcat (Java). The default memory is not enough to extract data which is more than 1000 records (estimation only). To do this, edit the $TOMCAT_ROOT/bin/setclasspath.sh and add the following lines at the end of file.

JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx768m -XX:PermSize=32m -XX:MaxPermSize=128m -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled "

Note: -Xs128m is referring to minimum allocated memory wheres the -Xmx768m is maximum allocated memory. Change the value based on total memory installed on the machine.

D. Edit configuration files

There are few configuration files that need to edit. The list of files and its contents as below:

  • $JASPER_ROOT/META-INF/context.xml
    <Context path="/jasperserver" debug="5" reloadable="true" crossContext="true">            
        <Resource name="jdbc/jasperserver" auth="Container" type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="jasperadmin" password="mypassword" driverClassName="org.postgresql.Driver"
            url="jdbc:postgresql://localhost:5432/prd_jasperserver" defaultAutoCommit="false"/>
    </Context>
  • $JASPER_ROOT/WEB-INF/hibernate.properties
    # Property that determines the Hibernate dialect
    metadata.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    metadata.hibernate.dataSource.jndiName=jdbc/jasperserver
  • $JASPER_ROOT/WEB-INF/js.mail.properties
    report.scheduler.mail.sender.host=smtp.raj2u.net
    report.scheduler.mail.sender.username=user@raj2u.net
    report.scheduler.mail.sender.password=password
    report.scheduler.mail.sender.from=user@raj2u.net
    report.scheduler.mail.sender.protocol=smtp
    report.scheduler.mail.sender.port=25
  • $JASPER_ROOT/WEB-INF/js.quartz.properties
    org.quartz.scheduler.instanceName=JasperServerScheduler
    org.quartz.threadPool.threadCount=20
    org.quartz.threadPool.threadPriority=5
    org.quartz.jobStore.misfireThreshold=180000
    org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
    org.quartz.jobStore.tablePrefix=QRTZ_

Note: Don't forget to put all the required JDBC drivers in $TOMCAT_ROOT/lib or $TOMCAT_ROOT/common/lib

Now you may start the Tomcat and check the Tomcat's log file to see that there are not serious errors on the startup. If JasperServer started up properly, you should be able to login. Login by going to the following URL: http://host-address:port/jasperserver. The default login information is written in the js-create-default-security.sql file.

JasperServer Customization -> HOW-TO

A. How to enable password encryption?

File that need to be edited is $JASPER_ROOT/META-INF/WEB-INF/ApplicationContext-security.xml

In the definition of the "daoAuthenticationProvider" bean, there is a commented-out reference to the passwordEncoder bean. Uncomment the reference to passwordEncoder and this causes the passwordEncoder logic to be used. After removing the commenting characters the line should look like the following:

 <property name="passwordEncoder"><ref local="passwordEncoder"/></property>

Now under the “passwordEncoder” bean, the property "allowEncoding" should be changed from false to true so that it looks like the following:

 <property name="allowEncoding"><value>true</value></property>

Once the changes described above are made, encryption is enabled for the JasperServer application upon the next restart.

Note: If the password in database is in clear text, please update to "A34FAB575B828B127AC85B236B096043" as we are using encryption and the password in clear text will be "mypassword".

B. How to change the login page?

Edit the $JASPER_ROOT/WEB-INF/bundles/jasperserver_messages.properties and change your desired text as below.

#Welcome Login Page
LOGIN_WELCOME_OS=Welcome to JasperServer Reporting System!
 
# the following 2 strings belong to the same sentence
LOGIN_ONLINE_DEMO_PRE=JasperServer is an open source business intelligence suite ....
LOGIN_ONLINE_DEMO=JasperReports is a powerful open source Java reporting tool ...

Now, replace the $JASPER_ROOT/WEB-INF/jsp/login_welcome.jsp with the one i attached here. You may see the differents before replace. Once the file replaced, the login page will look like below.

Jasper Login

C. How to change report export parameters?

You need to edit $JASPER_ROOT/WEB-INF/applicationContext.xml and $JASPER_ROOT/WEB-INF/applicationContext-report-scheduling.xml. Look for "export parameters" section:

<!-- export parameters -->
 
    <bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean">
        <property name="detectCellType" value="true"/>
        <property name="onePagePerSheet" value="false"/>
        <property name="removeEmptySpaceBetweenRows" value="false"/>
        <property name="removeEmptySpaceBetweenColumns" value="true"/>
        <property name="whitePageBackground" value="false"/>
        <property name="ignoreGraphics" value="false"/>
        <property name="collapseRowSpan" value="true"/>
        <property name="ignoreCellBorder" value="true"/>
        <property name="fontSizeFixEnabled" value="true"/>
        <property name="maximumRowsPerSheet" value="0"/>
        <property name="xlsFormatPatternsMap" ref="formatPatternsMap"/>
    </bean>
 
    <bean id="csvExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.CsvExportParametersBean">
        <property name="fieldDelimiter" value="|"/>
    </bean>
 
    <bean id="pdfExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.PdfExportParametersBean">
        <property name="localizedFontMap" ref="localePdfFontMap"/>
    </bean>
 
    <util:map id="formatPatternsMap">
        <!-- entry key="¤ #,##0.00" value="$ #,##0.00"/-->
    </util:map> 
 
    <!-- end export parameters -->

D. How to restrict report scheduling function?

You need to edit $JASPER_ROOT/WEB-INF/jsp/repository/repositoryExplorer.jsp and add the "authz:authorize ifAllGranted" to set the permission based on role. In example below, i have granted scheduling / run background to role "Administrator" only.

<authz:authorize ifAllGranted="ROLE_ADMINISTRATOR">
    <td style="cursor: pointer;" width='50' height='50' onClick='' id='schedule_td' align="center">
     <a href='#' class='normalpx' id='schedule_td_a'><img src="images/schedule_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_SCHEDULE_REPORT" javaScriptEscape="true"/>' id='schedule' /></a>
    </td>
 
    <td style="cursor: pointer;" width='50' height='50' onClick='' id='send_output_td' align="center">  
     <a href='#' class='normalpx' id='send_output_td_a'><img src="images/send_output_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_RUN_IN_BACKGROUND" javaScriptEscape="true"/>' id='send_output' /></a>
    </td>
</authz:authorize>

References

For more information on the installation guide and troubleshooting, please visit http://wwww.jasperforge.org

Comments

DDL files

Thanks for sharing these steps but where did you source js-create-schema.ddl, quartz-tables-postgres.sql, js-create-default-security.sql and js-create-trigger.sql from? I can't find these in the jasperserver-3.0-bin.zip distribution.

Calvin.

slightly connected question

Hi Raj,

Thanks for the post, but I have a separate question about using JasperServer Input Controls with a jrxml file.

I know it's slightly off the topic here, but I posted this question on the forum, and since know your stuff, was hoping you could probably answer this in a couple of seconds.

http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=45424

any help greatly appreciated

No luck...

No luck with these instructions. Thou I'm using MySql that is working fine with all the other Tomcat applications. Back to Crystal Reports it seems to me. Open source projects are ok if you aren't doing anything critical. For real life projects, just forget it.

js.mail.properties

Hi,

thanks for this post.

I have got an issue with the mail . The server is not able to send mail
I have got a JasperServer-pro 3.0.2. running on linux plaform (redhat enterprise 5.2).

The file js.mail.properties was missing, I have created a new one and put all informations (mail server, protocol, port, user...).

I have stop and restard the jasperserver.
I have got always error messages : Caused by: javax.mail.MessagingException: Unknown SMTP host: mail.localhost.com;

But it is strange, because I have put my smtp server and not mail.locahost.com

I have installed jasperserver release 3.0.1 on my computer (windows XP). I have put the same js.mail.proerties locally, and it works !!!!!!

Is there any issue with linux ?, with 3.0.2 ?

Why jasperserver still using mail.localhost.com ?

Thanks for any advice

jar xvf jasperserver.war

Hi,
I am using Centos 4.4. I am trying to install jasperserver on my pc. I followed the above procedure, but stucked on section "C" ( Install/Deploy JasperServer into Tomcat ).
When i run # jar xvf /path/jasperserver.war /path/jasperserver it doesn't extract any fine in jasperserver directory.

Waiting for Reply.

thanks
sandeep

Cant find *.sql

Hi...

I've downloaded the js 3.1. Where can I find js-create-trigger.sql, js-create-default-security.sql and js-create-schema.sql?

I don't find them in any part of my installation.

regards

Map Long to blob Exception

I've set up a new Jasperserver 3.1 following your tutorial.
I have a Windows Server with a PostgreSQL 8.3 DB.
Everything worked smooth(login, creating data sources,...) until i tried to add my first Report to the Server.
I created a Report with 2 Input Controls and saved it.
When i try to view the report on the repository it doesn't appear, the idle icon next to the folder doesn't disappear.
Here's the exception from the log:

org.hibernate.HibernateException: I don't know how to map the type java.lang.Long to a blob

I can also post the whole Stacktrace if this helps (just don't wanted to flood the comments area)

Carsten

I just got stuck in the same

I just got stuck in the same way... "I don't know how to map the type java.lang.Long to a blob" after importing my first report, using postgresql 8.3.5...

Has anyone found a solution yet?

Fixed!

hey, I've found the solution:

- I've re-created the database using the scripts available at http://jasperforge.org/scm/viewvc.php/trunk/buildomatic/install_resources/sql/postgresql/?root=jasperserver

- I've changed the line:
metadata.hibernate.dialect=com.jaspersoft.hibernate.dialect.PostgresqlNoBlobDialect
in WEB-INF/hibernate.properties

- I've removed defaultAutoCommit="false" from META-INF/context.xml (as suggested on JasperForge forums)

JasperServer 3.1 PostgreSQL Schema

Dear Anandharaj,

For JasperServer 3.1, there using PostgreSQL, and using Hibernate dialect: "com.jaspersoft.hibernate.dialect.PostgresqlNoBlobDialect", your schema has to be changed slightly.

In fact i have only done a minimal test, but at least i am not getting errors when i upload an input control or file. Basically i changed the OID type colums with Bytea.

If you think it might be helpful for you, just write to me and i will send it corrected.

Thanks for your great help in getting PostgreSQL up with JS.

RE:JasperServer 3.1 PostgreSQL Schema

can you possibly post that 3.1 schema? I have been attempting to get things up and running using postgreSQL and only having minimal luck - I can get the server to run, etc but I can't delete or modify reports for instance, or run in the background
Cheers,
Ben

Tomcat start up error please help

8:43,663 WARN SettingsFactory,main:109 - Could not obtain connection metadata
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:804)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:744)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBe

JasperServer with weblogic

Hi All,

I am new to jasperserver and ireport. How to use jasperserver with weblogic 10.3. How to start and stop jasper server?. Is tomact is default for jasperserver? After login asjasperadmin i didnot find any options to restart. Please help me out. Thanks in advance.

Sridhar.

Pages

Add new comment