Specifying the reporthome in web.xml or ejb-jar.xml
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.
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:
-Duser.home=xxx
). So you can also specify different folders for this JVM option.
-Duser.home
in the script file that starts JReport Server.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:
|
This is the recommended way to set reporthome since the <env-entry></env-entry> tags are also supported in ejb-jar.xml (if you call the Server API in your EJB).
|
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,
|
Set the JVM option -Dreporthome
before starting the application server, for example:
-Dreporthome=/home/jreport
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);