Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installation of the JasperServer CE

DZone's Guide to

Installation of the JasperServer CE

How to install JasperServer CE in order to create operational reports and share them as PDFs.

· Big Data Zone
Free Resource

Effortlessly power IoT, predictive analytics, and machine learning applications with an elastic, resilient data infrastructure. Learn how with Mesosphere DC/OS.

Today I decided to install the JasperServer CE. We need to create operational reports and generate PDF documents. This solutions fits our need and the installation was the last step to generate them.

The requirements we have:

  • Install in the backed zone
  • Access through proxy server with TLS certificate
  • Route managed with OpenShift

Installation Steps

I downloaded the installer from the site and run them. After answering some questions the installation begins. When the installator want to know port numbers I add 30000 as the prefix. So the ports are: 38080, 38005, 38009.

Running JasperServer

In the installation folder is a script named ctlscript.sh

# ./ctlscript.sh restart

Managing through OpenShift

At first I created a new project named routes. This project holds external services. To expose the external service through OpenShift, we have to:

  1. Create a project

  2. Create an endpoint

  3. Create a service

  4. Create a route

Create Project

To create a project use the OpenShift client:

# oc new-project routes

Note: the project is automatically selected if you create them.

Create Endpoint

The snippet below shows you the endpoint definition. The important sections are the name, IP address, and ports.

kind: "Endpoints"
apiVersion: "v1"
metadata:
  name: "external-reports-service"
subsets:
- addresses:
  - ip: "10.10.121.132"
  ports:
  - name: "http"
    port: 38080
  - name: "https"
    port: 38443

You can create endpoints in many different ways. The first way is to use the OpenShift client. Store this snippet to a file called endpoint.yaml and run:

# oc create -f endpoint.yaml

The second way is to use the console (https://master:8443/console):

OpenShift console

At this time the endpoint is created. You can continue to the service.

Create the Service

You have the same ways to create service. Service definition is:

kind: "Service"
apiVersion: "v1"
metadata:
  name: "external-reports-service"
spec:
  ports:
    -
      name: "http"
      protocol: "TCP"
      port: 8080
      targetPort: 38080
    -
      name: "https"
      protocol: "TCP"
      port: 8443
      targetPort: 38443
selector: {}

The important part is the name of the service and endpoint.

Create Route

Route is the last step to publish the external service to the Internet. I'm used to creating routes in the web console. Let's assume that you create a classic edge route to the service port http. This will listen at the IP:443 and forward it to the 10.10.121.132:8080. Everything looks fine, but some resources from JasperServer are downloaded via a nonsecured protocol, and this is a problem.

Solution

We have to set tomcat to use only https port. But for it you need the certificate. We only have httpd-like certificate. So after digging some sites we finally create an JKS certificate.

We have to edit the embeded Tomcat server and add a new Connector:

# vim /opt/jasperreports-server-cp-6.3.0/apache-tomcat/conf/server.xml

And add:

<Connector port="38443" protocol="HTTP/1.1" SSLEnabled="true"
      maxThreads="150" scheme="https" secure="true"
      clientAuth="false" sslProtocol="TLS"
      keystoreFile="/opt/jasperreports-server-cp-6.3.0/ssl/reports.jks"
      keystorePass="password" />

You can see that the port 38443 is used in the endpoint and service definition. After restarting the tomcat listen on the port 38443 and uses our certificate.

Delete Route and Create New

You have to delete the old route and create a new one with the Passthrough TLS termination. You have to change the endpoint for the route — the port 8443 (forwarded to port 38443).

Image title

At this time you have to access your JasperServer. 

Learn to design and build better data-rich applications with this free eBook from O’Reilly. Brought to you by Mesosphere DC/OS.

Topics:
java ,jasperserver ,openshift origin ,big data

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}