Using the default implementations of jet.server.api.http.CustomizedServerEnv

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:

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:

  1. In the file makewar.xml, use the <env-entry></env-entry> tags to specify jet.server.MultipleInstanceServerEnv in the target "web.xml". For example:
    <env-entry>
        <env-entry-name>jreport.servenv</env-entry-name>
        <env-entry-value>jet.server.MultipleInstanceServerEnv</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
  2. Since different JReport instances cannot access the same JReport Server system database at the same time, you will need to create a dbconfig.xml file to store the connection information, and put it in jrenv.jar in 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.

  3. When the JReport Server WAR/EAR has been deployed, JReport will create a file .jreportrc in <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.