The self-contained JReport Server provides two implementations of CustomizedServerEnv. They are jet.server.DefaultServerEnv and jet.server.MultipleInstanceServerEnv.
jet.server.DefaultServerEnv
If you use this implementation, you will not need to specify it in the target "web.xml" in the makewar.xml or in ejb-jar.xml, since it can find the customized reporthome from the <context-param></context-param>
tags of the target "web.xml" or the <env-entry></env-entry>
tags of web.xml or ejb-jar.xml.
jet.server.MultipleInstanceServerEnv
This implementation is extended from DefaultServerEnv. It enables finding the reporthome not only from <context-param></context-param>
or <env-entry></env-entry>
tags, but also from an external file <user.home>/.jreportrc. However, this implementation has three main limitations. They are:
<env-entry></env-entry>
tags in the target "web.xml" in the makewar.xml or in ejb-jar.xml, as follows:
|
Since in cases of deploying multiple JReport Server instances in one Java EE application server without touching the WAR, such as extracting the WAR, setting reporthome and rebuilding the WAR, JReport Server has to use ServletContext to generate an ID for every instance. JReport Server retrieves javax.servlet.context.tempdir from ServletContext by invoking the getAttribute(String) method, and then uses this value to generate the instance ID.
For detailed information, see Java Servlet Specification Version 2.3/2.4 SRV.3.7.1 Temporary Working Directories.
Since the instance ID is generated based on a hash code retrieved from javax.servlet.context.tempdir, it cannot be pre-assigned, and is therefore impossible for you to create the <user.home>/.jreportrc file. However, once the file has been created, you can edit it to change the reporthome for each instance. The RC file can hold multiple records. The record format should be as follows:
jreport.rpthome.<instanceID>=the-instance-report-home
The instanceID is created by JReport Server during its first initializing. It is a string of HEX encoded hash value. For example:
jreport.rpthome.12345678=/home/user1/.jreport/instance.12345678
jreport.rpthome.12345abc=/home/user1/.jreport/instance.12345abc
If JReport Server cannot get the reporthome from CustomizedServerEnv, it will create a default reporthome in <user.home>/.jreport/default
.
The following is an example of specifying reporthomes when deploying multiple server instances using jet.server.MultipleInstanceServerEnv:
Example: Specifying reporthomes when deploying multiple server instances
JReport Server provides an internally implemented class of the jet.server.api.http.CustomizedServerEnv interface - jet.server.MultipleInstanceServerEnv which supports multiple JReport Server instances in one Java EE application server. The reporthome of each instance can be assigned by the class automatically. To do this, follow the steps below:
<env-entry></env-entry>
tags to specify jet.server.MultipleInstanceServerEnv in the target "web.xml". For example:
|
workspace\bin
(you can find the jrenv.jar file after extracting jreport.war) for each JReport Server WAR/EAR.
For detailed information about modifying the dbconfig.xml, see Configuring the server database.
<user.home>
, and each JReport instance will read its reporthome from this file. This file must be created by JReport Server, however, you can edit it in order to change the reporthome after it has been created.