Apereo CAS - Payara Micro Deployments

Posted by Misagh Moayyed on January 12, 2020 · 2 mins read

Overview

Payara Micro is the open source, lightweight middleware platform of choice for containerized Java EE (Jakarta EE) microservices deployments. Less than 70MB in size, Payara Micro requires no installation or configuration and no need for code rewrites – so you can build and deploy a fully working app within minutes.

This is a short and sweet tutorial on how to get Apereo CAS deployed via Payara Micro.

Our starting position is based on:

Configuration

Clone the CAS WAR overlay and then download the Payara Micro application server. Next, in gradle.properties file, blank out the application server property:

appServer=

Next, make sure src/main/webapp/WEB-INF/web.xml exists in the overlay with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 
     metadata-complete="true"
     xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>

The key in the above snippet is metadata-complete="true"; it indicates that the JAR files in /WEB-INF/lib don’t need to be scanned for Servlet 3.0 specific annotations, but the webapp’s own classes will still be scanned. This is to specifically prevent this bug.

Finally, build the overlay using ./gradlew clean build and then deploy to Payara Micro using:

java -jar /path/to/payara-micro.jar --deploy /path/to/cas-overlay/build/libs/cas.war

Once the deployment is complete, CAS will be available at http://localhost:8080/cas.

So…

I hope this review was of some help to you and I am sure that both this post as well as the functionality it attempts to explain can be improved in any number of ways. Please know that all other use cases, scenarios, features, and theories certainly are possible as well. Feel free to engage and contribute as best as you can.

Happy Coding,

Misagh Moayyed