Using MidPoint with embedded Tomcat

Last modified 26 Mar 2025 11:03 +01:00

This guide explains how to configure and run MidPoint with embedded Tomcat. This feature is based on spring libraries, especially spring boot framework.

Configuration

MidPoint configuration is done as usual in config.xml file located in midpoint.home. Configuration for embedded tomcat can be done in two places. Default configuration file name application.yml is located on classpath (admin-gui/src/main/resources folder). Custom configuration file application.yml can be placed to midpoint.home folder.

The values can be also overwritten as JVM argument ( -Dxxx before application). For this purpose the JAVA_OPTS variable can be used or MP_SET_ variables (see dedicated Start script doc page).

Available is also passing the values as application argument ( --xxx after application ).

The examples are available later in the document.

List of available properties is based on spring boot configuration options and can be found here.

Custom configuration items

Custom configuration items
wicket:
    request-cycle:
        timeout: 60s # specifies timeout for wicket page rendering

Configuration example 1

This example is utilizing the processing of the MP_SET_* environment variables in Start script. The result is list of the -D parameter (as in the example 2). The benefit of this approach is that the options can be handled as one property per one variable.

The primary target is for the containerized environment - docker, kubernetes (clouds).

start the midPoint - midPoint is in "default" location /opt/midpoint
MP_SET_server_port=8088 MP_SET_server_servlet_session_timeout=60m /opt/midpoint/bin/midpoint.sh start

It can be used also to generate systemd service with -Dxxx parameters - it is also mantioned on the Start script doc page.

generate systemd object - midPoint is in "default" location /opt/midpoint
MP_SET_server_port=8088 MP_SET_server_servlet_session_timeout=60m /opt/midpoint/bin/midpoint.sh generate

Configuration example 2

This is the native way how to overwrite the values - to set without editing the files.

example of passing the JVM argument
java -Dserver.port=8088 -Dserver.servlet.session.timeout=60m [<other parameters>] -Dmidpoint.home=/opt/midpoint-home -jar midpoint.war
example of passing the program argument
java  [<other parameters>] -Dmidpoint.home=/opt/midpoint-home -jar midpoint.war --server.port=8088 --server.servlet.session.timeout=60m

Configuration example 3

application.yml - json format
server.port: 8088
server.servlet.session.timeout: 60m
application.yml - yaml format
server:
    port: 8088
    servlet:
        session:
            timeout: 60m

(TODO: suffix "m" does not work - should be updated!)

Other configuration

  • Banner (midpoint logo in logs)

    • used spring boot standard banner.txt file

  • Static files moved to src/main/resources/static (default for spring boot)

JDBC Drivers

Currently, midPoint bundles only PostgreSQL JDBC driver. If one wants to deploy standalone midPoint with different database, then jdbc driver must be copied to midpoint.home/lib .

Executable Jar Start/Stop

Example command with minimum options (memory and midpoint.home configuration) using midpoint.war from dist/target folder:

Start command example
java -Xms768m -Xmx2048m -Dmidpoint.home=/opt/midpoint-home -Dmidpoint.nodeId=node1 -jar midpoint.war

Other options can be added from list of properties (table above) using -D option, e.g. -Dserver.port=12345. Options explicitly stated in command will override defaults located in midpoint.home/application.yml.

Using midPoint with embedded Tomcat

Use the default URL (modify hostname and port as required): http://localhost:8080/

Autoconfiguration

MidPoint web application is autoconfigured by using the com.evolveum.midpoint.web.boot.MidPointSpringApplication class as a starting point. Spring boot will process all the annotated methods of this class in a "configuration code" approach. Additional autoconfiguration classes are also used. Those are listed in the @ImportAutoConfiguration annotation.

Autoconfiguration is used as a replacement for JEE deployment descriptor (web.xml). E.g. servlets and servlet mappings are initialized in the MidPointSpringApplication class.

SSL Configuration

When we use Embedded Tomcat, then we can configure ssl in application.yml file.

Example
server:
  ssl:
    enabled: true
    keyStoreType: PKCS12
    key-store: /pathToCertificate/certificate.p12
    key-store-password: password

This is basic example. You can use next configuration variable. Please see configuring SSL in Spring Boot.

Was this page helpful?
YES NO
Thanks for your feedback