Some Useful Settings in JasperReports Server

Doug WaltonCloud Engineer
Published:
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
If you're setting up a Jasper Server instance these settings and file locations should come in handy.  It's not super obvious where you can find how to change all this in the handbook, so I've compiled a list of the ones I ended up changing for my instance here.

The file locations depend on where your Jasper Server is running tomcat (For example, /usr/share/tomcat7/).  Below, I'll specify all the file locations starting with $TOMCAT_HOME.  Also, all the below file locations are assuming you're using Jasper Server Pro, if you're using the normal Jasper Server replace "jasperserver-pro" with "jasperserver."

Also it's worth mentioning after changing these files tomcat should be restarted to make the changes take effect.  If anyone is currently logged into the server when you restart tomcat they'll have to login again, which will probably stop any reports they were running.
 

Password Settings

This file contains some password/security settings for allowing users to change their password, setting a password expiration, and allowing autocomplete on the login form.  Open this file then look for the following lines.

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/jasperserver-servlet.xml
<property name="allowUserPasswordChange" value="true"/>
                      <property name="passwordExpirationInDays" value="90"/>
                      <property name="autoCompleteLoginForm" value="true"/>

Open in new window

 

Default Date and Time Formats

If your system/company uses a different format than what is showing up in your Jasper Server instance, this is the place to change it.

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/bundles/jasperserver_config.properties
# Used for parsing and formatting dates by server
                      date.format=yyyy-MM-dd
                      datetime.format=yyyy-MM-dd HH:mm:ss
                      time.format=HH:mm:ss
                      
                      # Used for parsing and formatting dates by calendar component (UI).
                      # Pattern for date should match appropriated pattern from server properties.
                      # The format for calendar component can be combinations of the following:
                      # d  - day of month (no leading zero)
                      # dd - day of month (two digit)
                      # o  - day of year (no leading zeros)
                      # oo - day of year (three digit)
                      # D  - day name short
                      # DD - day name long
                      # m  - month of year (no leading zero)
                      # mm - month of year (two digit)
                      # M  - month name short
                      # MM - month name long
                      # y  - year (two digit)
                      # yy - year (four digit)
                      calendar.date.format=yy-mm-dd
                      calendar.datetime.format=yy-mm-dd HH:mm:ss
                      calendar.time.format=HH:mm:ss

Open in new window



Enabling Datatypes

By default several datatypes aren't supported (CLOB, BLOB).  This is where you can enable them and define the default java class to assign to them.

 $TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/applicationContext-semanticLayer.xm
<property name="jdbc2JavaTypeMapping">
                                  <map>
                                      <!--entry key="ARRAY" value=""/-->
                                      <entry key="BIGINT" value="java.lang.Long"/>
                                      <!--entry key="BINARY" value=""/-->
                                      <entry key="BIT" value="java.lang.Boolean"/>
                                      <entry key="BOOLEAN" value="java.lang.Boolean"/>
                                      <entry key="BLOB" value="java.lang.String"/>
                                      <entry key="CHAR" value="java.lang.String"/>
                                      <entry key="CLOB" value="java.lang.String"/>
                                      <entry key="DATE" value="java.util.Date"/>
                                      <entry key="DECIMAL" value="java.math.BigDecimal"/>
                                      <!--entry key="DISTINCT" value=""/-->
                                      <entry key="DOUBLE" value="java.lang.Double"/>
                                      <entry key="FLOAT" value="java.lang.Float"/>
                                      <entry key="INTEGER" value="java.lang.Integer"/>
                                      <!--entry key="JAVA_OBJECT" value=""/-->
                                      <!--entry key="LONGVARBINARY" value=""/-->
                                      <entry key="LONGVARCHAR" value="java.lang.String"/>
                                      <!--entry key="NULL" value=""/-->
                                      <entry key="NUMERIC" value="java.math.BigDecimal"/>
                                      <entry key="OTHER">
                                          <map>
                                              <entry key="NVARCHAR2" value="java.lang.String"/>
                                              <entry key="uuid" value="java.lang.String"/>
                                          </map>
                                      </entry>
                                      <entry key="REAL" value="java.lang.Double"/>
                                      <!--entry key="REF" value=""/-->
                                      <entry key="SMALLINT" value="java.lang.Short"/>
                                      <!--entry key="STRUCT" value=""/-->
                                      <entry key="TIME" value="java.sql.Time"/>
                                      <entry key="TIMESTAMP" value="java.sql.Timestamp"/>
                                      <entry key="TINYINT" value="java.lang.Byte"/>
                                      <!--entry key="VARBINARY" value=""/-->
                                      <entry key="VARCHAR" value="java.lang.String"/>
                                      <entry key="NVARCHAR" value="java.lang.String"/>
                                      <entry key="ARRAY" value="java.lang.String"/>
                                  </map>
                              </property>

Open in new window



Enabling Oracle Synonyms

You might not need this, but if you're wondering why some objects aren't showing up in your domain designer you might need to make sure this is set to true.

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/applicationContext-semanticLayer.xml
      <property name="includeSynonymsForOracle">
                                  <!-- set 'true' if you use Oracle synonyms in Domains  -->
                                  <value>false</value>

Open in new window

 

Max Execution Time and Max Result Set Rows

Sometimes reports take a long time to run or return a lot of data.  If you're getting errors about timing out or too many result set rows, you can change those limits here.

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/applicationContext-semanticLayer.xml
        <property name="maxAvailableValues" value="10000"/>
                              <property name="tempFolderUri" value="/temp"/>
                              <property name="defaultFolderUri" value="/adhoc/topics"/>
                              <property name="maxExecutionTimeSec" value="360"/>
                              <property name="maxResultSetRows" value="200000"/>

Open in new window

 

Turning Off Domain Validation

I don't recommend doing this permanently unless your jasper server instance is painfully slow when trying to save changes to the domain.  This will make it so it skips turning off the initial domain checker, but it should still run when you click the final submit button (skips the check on the first submit button).

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/applicationContext-semanticLayer.xml
       <!--
                                  2014-12-05  thorick
                                  Note:  skipping Domain Database Validation will also turn off domain schema Advanced Joins Complex Joins validation
                                  http://bugzilla.jaspersoft.com/show_bug.cgi?id=40342
                              -->
                              <property name="skipDomainDatabaseValidation" value="true"/>

Open in new window

 

File Type Export Options

This is where you can specify export options for each file type.  I found this when I was trying to figure out why my borders and images weren't showing up in excel reports.

$TOMCAT_HOME/webapps/jasperserver-pro/WEB-INF/applicationContext.xml
<!--export parameters-->
                      <bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean">
                          <property name="detectCellType" value="true"/>
                          <property name="onePagePerSheet" value="true"/>
                          <property name="removeEmptySpaceBetweenRows" value="true"/>
                          <property name="removeEmptySpaceBetweenColumns" value="true"/>
                          <property name="whitePageBackground" value="false"/>
                          <property name="ignoreGraphics" value="false"/>
                          <property name="collapseRowSpan" value="false"/>
                          <property name="ignoreCellBorder" value="false"/>
                          <property name="fontSizeFixEnabled" value="true"/>
                          <property name="maximumRowsPerSheet" value="0"/>
                          <property name="xlsFormatPatternsMap" ref="formatPatternsMap"/>
                        </bean>
                        <bean id="odsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.OdsExportParametersBean" parent="xlsExportParameters"></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"></bean>
                        <bean id="txtExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.TxtExportParametersBean">
                          <property name="characterWidth" value="10"/>
                          <property name="characterHeight" value="10"/>
                          <property name="pageHeight" value="100"/>
                          <property name="pageWidth" value="80"/>
                        </bean>
                        <bean id="pptxExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.PptxExportParametersBean">
                          <property name="ignoreHyperlink" value="false"/>
                        </bean>
                        <bean id="jsonMetadataExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.JsonMetadataExportParametersBean"></bean>
                        <util:map id="formatPatternsMap">
                          <!--entry key="$ #,##0.00" value="$ #,##0.00"/-->
                        </util:map>
                        <!--end export parameters-->

Open in new window


Hope this helps!
 
2
3,783 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.