BackPrevious Page Next PageNext

Specifying Reporthome for JReport Server in a Java EE Environment

Using the default reporthome

Specifying the reporthome in web.xml or ejb-jar.xml

Specifying the reporthome using the JVM -D parameter

Specifying the reporthome by invoking API method

JReport Server requires a reporthome as its working space to hold the entire JReport runtime environment, including the server properties, configuration files and resources. The package jrenv.jar that contains the entire JReport runtime environment will be extracted to the specified reporthome when initializing JReport Server. The reporthome can be any location on the disk where JReport Server has the Read and Write privileges.

You can either use the default reporthome or customize the reporthome location before creating the JReport Server WAR/EAR file. You should make sure that the reporthome for the integrated JReport Server is different from that of the standalone JReport Server.

JReport also provides you with the jet.server.api.http.CustomizedServerEnv interface for specifying the JReport Server reporthome and for setting the server properties in a Java EE environment. If you specify the implementation of this interface, JReport Server will obtain not only reporthome but also server properties. For details, see Setting Server Reporthome and Properties in a Java EE Environment.

Using the default reporthome

If you do not specify a reporthome, the self-contained JReport Server will create a default working folder. The default working folder is <user.home>/.jreport/default, where <user.home> is the system property user.home retrieved from Java VM. JReport Server has the Read and Write privileges in this directory. Different OSs have different real paths for <user.home>. For example,

For Windows: C:\Documents and Settings\username

For Unix/Linux: /home/username

Notes:

Specifying the reporthome in web.xml or ejb-jar.xml

It is recommended that you use the <env-entry></env-entry> tags to specify the reporthome directly in the target "web.xml.norpthome" in the makewar.xml file or in ejb-jar.xml. Also, in the target "web.xml.filter", you can specify the reporthome using the <context-param></context-param> tags.

To specify the reporthome for WAR:

You can use one of the two methods listed below to specify the reporthome for WAR:

To specify the reporthome for EAR:

The same methods can be used to specify the reporthome of building the EAR file as of building the WAR file. However, because you can wrap WAR and EJB in the EAR file, you should ensure that you put the reporthome information either in the target "web.xml.norpthome" in the makewar.xml file (for the web module) or in ejb-jar.xml (for the EJB module).

In ejb-jar.xml, use the <env-entry></env-entry> tags to specify the reporthome. For example,

<env-entry>
    <env-entry-name>jreport.rpthome</env-entry-name>
    <env-entry-value>/home/jreport</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
<env-entry>

Specifying the reporthome using the JVM -D parameter

Set the JVM option -Dreporthome before starting the application server, for example:

-Dreporthome=/home/jreport

Specifying the reporthome by invoking API method

You can invoke the method jet.server.api.http.HttpUtil.initEnv(Properties props) to specify the reporthome.

For example:

Properties props = new Properties();
props.setProperty("reporthome", "/home/test/JReport");
HttpUti.initEnv(props);

BackPrevious Page Next PageNext