BackPrevious Page Next PageNext

Running as an OS Service

Running as a Windows service

Running as a service on Unix

Running as a service on Linux

JReport Server can be configured as an OS service. This section shows you how to run JReport Server as a service of Windows, Unix and Linux.

Running as a Windows service

The tool JRservice.exe saved in <install_root>\bin is provided to assist you in installing JReport Server as a Windows service.

You can get the following information if you run JRservice.exe without any options:

Usage:

JRService -install [-interactive] to install the service
JRService -remove                 to remove the service

    -interactive to enable JReport Server service
                 to interact with the desktop

StartServiceCtrlDispatcher being called.
This may take several seconds. Please wait.

Configuring the service

The parameters for the Windows service of JReport Server are read from the file NTService.ini in <install_root>\bin. In this file, you can find three parameters specified, as shown in the following example:

JavaVM="C:\Program Files\Java\jdk1.7.0_51\bin\java.exe"
StartArg= "-Dinstall.root=C:\JReport\Server" -classpath "C:\JReport\Server\derby\lib\*;C:\JReport\Server\lib\JREngine.jar; C:\JReport\Server\lib\JRESServlets.jar;C:\JReport\Server\lib\JRStructuredEngine.jar;C:\JReport\Server\lib\JRStructuredClient.jar ;C:\JReport\Server\lib\JREntServer.jar;C:\JReport\Server\lib\maintain.jar;C:\JReport\Server\lib\JRWebDesign.jar; C:\JReport\Server\lib\*;C:\Program Files\Java\jdk1.7.0_51\lib\tools.jar;" -Xms256m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=128m -Xrs -Djava.net.preferIPv4Stack="true" "-Djreport.url.encoding=UTF-8" -Dreporthome="C:\JReport\Server" jet.server.JREntServer
ShutdownArg= "-Dinstall.root=C:\JReport\Server" -classpath "C:\JReport\Server\derby\lib\*;C:\JReport\Server\lib\JREngine.jar; C:\JReport\Server\lib\JRESServlets.jar;C:\JReport\Server\lib\JRStructuredEngine.jar;C:\JReport\Server\lib\JRStructuredClient.jar; C:\JReport\Server\lib\JREntServer.jar;C:\JReport\Server\lib\maintain.jar;C:\JReport\Server\lib\JRWebDesign.jar;C:\JReport\Server\lib\*;" -Xmx512m -Xrs -Dreporthome="C:\JReport\Server" jet.server.CommandSender localshutdown

Starting the service

There are two ways to start the JReport Server service.

You can change the options in the file NTService.ini in <install_root>\bin before you start the service (for more information on the options available, see Starting JReport Server Using Java). In the example above, there are no options specified in StartArg. If you would like to set all log level to INFO, you will need to append -logall at the end, as in the following example:

... 
StartArg= "-Dinstall.root=C:\JReport\Server"
-classpath "C:\JReport\Server\lib\JREntServer.jar;
C:\JReport\Server\lib\JREngine.jar;C:\JReport\Server\lib\javax.servlet-api-3.1.0.jar;
C:\JReport\Server\lib\log4j-core-2.7.jar;C:\JReport\Server\lib\log4j-api-2.7.jar;C:\TEMP" -Djava.compiler=NONE 
-Dreporthome=C:\JReport\Server jet.server.JREntServer -logall
...

Stopping the service

There are three ways for you to stop the JReport Server service:

Notes:

Running as a service on Unix

Assume that JReport Server has been installed to /user/report/jns,

  1. Write a script /etc/init.d/jrserver as follows, and make it executable.
    #!/bin/sh
    mode=$1
    if [ ! -d /user/report/jns ]
    then # JReport not installed
    exit 1
    fi
    case "$mode" in
    'start')
    if [ -d /user/report/jns ]
    then
    echo "Starting JReport Server"
    /user/report/jns/bin/NJRServer.sh &
    fi
    ;;
    'stop')
    if [ -d /user/report/jns ]
    then
    echo "Stopping JReport Server"
    /user/report/jns/bin/CmdSender.sh localshutdown &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start JReport Server)"
    echo " $0 stop (stop JReport Server)"
    exit 1
    ;;
    esac
    exit 0
  2. Create a soft link to /etc/rc2.d/S99jrserver.

    ln -s /etc/init.d/jrserver /etc/rc2.d/S99jrserver

  3. Create a soft link to /etc/rc0.d/K99jrserver.

    ln -s /etc/init.d/jrserver /etc/rc0.d/K99jrserver

Running as a service on Linux

Running JReport Server as an OS service on Linux is more or less the same as with running on Unix. Here it is assumed that your default start up rc is rc5.

Setting up XVFB

  1. Install XVFB.
  2. Write a script /etc/init.d/xvfb as follows, and make it executable.
    #!/bin/sh
    mode=$1
    case "$mode" in
    'start')
    echo "start xvfb "
    if [ -f /usr/X11R6/bin/Xvfb ]
    then
    /usr/X11R6/bin/Xvfb :1 -screen 0 1152x900x8 &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start XVFB)"
    echo " $0 stop (stop XVFB not support)"
    exit 1
    esac
    exit 0
  3. Create a soft link to /etc/rc5.d/S97xvfb.

    ln -s /etc/init.d/xvfb /etc/rc5.d/S97xvfb

Using rc to run JReport Server as a service

Assume that JReport Server has been installed to /JReport/Server.

  1. Write a script /JReport/Server/bin/JRServer as shown below, and make it executable. Here it is assumed that JReport Server is running on a machine with IP address 127.0.0.1.
    #!/bin/sh
    DISPLAY=127.0.0.1:1.0
    export DISPLAY
    /JReport/Server/bin/JRServer -silent "$@"
  2. Write a script /etc/init.d/jrserver as follows, and make it executable.
    #!/bin/sh
    mode=$1
    if [ ! -d /JReport/Server ]
    then # JReport not installed
    exit 1
    fi
    case "$mode" in
    'start')
    if [ -d /JReport/Server ]
    then
    echo "Starting JReport Server"
    cd /JReport/Server/bin/;
    JRServer -silent & 
    fi
    ;;
    'stop')
    if [ -d /JReport/Server ]
    then
    echo "Stopping JReport Server" 
    /JReport/Server/bin/CmdSender localshutdown &
    fi
    ;;
    *)
    echo " Usage: "
    echo " $0 start (start JReport Server)"
    echo " $0 stop (stop JReport Server)"
    exit 1
    ;;
    esac
    exit 0
  3. Create a soft link to /etc/rc5.d/S98jrserver.

    ln -s /etc/init.d/jrserver /etc/rc5.d/S98jrserver

  4. Create a soft link to /etc/rc5.d/K98jrserver.

    ln -s /etc/init.d/jrserver /etc/rc5.d/K98jrserver

If all has been carried out successfully, the installation of the service will now have finished. JReport Server is now ready to run as a daemon process.

BackPrevious Page Next PageNext