Using MidPoint with embedded Tomcat
This section needs to be reviewed with regards to the current version of Spring Boot used.
However, documentation work is similar to the development work in that it takes time and that it needs funding.
This guide explains how to configure and run MidPoint with embedded Tomcat.
This feature is available since MidPoint version 3.7. No configuration changes needed in case you want to run MidPoint WAR inside standard Tomcat.
This feature is based on spring libraries, especially spring boot framework. Libraries used:
boot - 1.5.8.RELEASE
spring - 4.3.12.RELEASE
security - 4.2.3.RELEASE
MidPoint configuration is done as usual in config.xml file located in
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
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.
Following table shows list of available properties that can be used to cofnigure tomcat (e.g. http/https ports, session timeouts, logging, max-post-size, etc.).
Full list of properties is available here.
Web descriptor -
web.xml was removed, all servlets and filters are registered/defined using servlet api in
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).
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.
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.
java -Dserver.port=8088 -Dserver.servlet.session.timeout=60m [<other parameters>] -Dmidpoint.home=/opt/midpoint-home -jar midpoint.war
java [<other parameters>] -Dmidpoint.home=/opt/midpoint-home -jar midpoint.war --server.port=8088 --server.servlet.session.timeout=60m
Configuration example 3
server.port: 8088 server.servlet.session.timeout: 60m
server: port: 8088 servlet: session: timeout: 60m
(TODO: suffix "m" does not work - should be updated!)
Web security configuration
defined in WebSecurityConfig.java
ctx-web-security-*.xmlcontexts are still available, but not used
cas and ldap configuration not available now (needs to be finished)
Banner (midpoint logo in logs)
used spring boot standard banner.txt file
static files moved to src/main/resources/static (default for spring boot)
Currently midPoint bundles only PostgreSQL and H2 jdbc driver.
If one wants to deploy standalone midPoint with different database, then jdbc driver must be copied to
Executable Jar Start/Stop
Example command with minimum options (memory and midpoint.home configuration) using
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
Using midPoint with embedded Tomcat
Use the default URL (modify hostname and port as required): http://localhost:8080/
MidPoint web applicaiton 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 autocofiguration 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.
When we use Embedded Tomcat, then we can configure ssl in application.yml file.
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.
This is a missing or incomplete feature of midPoint and/or of other related components. We are perfectly capable to implement, fix and finish the feature, just the funding for the work is needed. Please consider the possibility for supporting development of this feature by means of midPoint Platform subscription. If you already are midPoint Platform subscriber and this feature is within the goals of your deployment you may be able to use your subscription to endorse implementation of this feature.
It is not yet clear how to set up data sources for embedded Tomcat.
Redirect from / to /midpoint
Servelt for static content