Is it possible to run platform server standalone?

As platform server is a spring boot application I wonder if it is possible to build it as a standard spring boot fat jar (with included application server).

Currently the platform server is build as a war archive and is required to run in an external application server. As I don’t use that app server for anything else but have some problems with duplicate configuration (session timeouts, debugging, etc…) I would prefer to have a standalone server.

Is it possible? Has anyone done it?

Within the release page <INTERNAL_LINK> you will find rest-server-app as a jar dependencies.

  • Create your main class for spring boot application
  • add dependency for rest-server-app
  • add dependency for org.springframework.boot:spring-boot-starter-web
  • add dependency for ui-model (melies-model [exclude slf4j-log4j12], overview-model [exclude slf4j-log4j12])

Then you should have your own spring boot application.

I’ve got it to work as a standalone application.

buildscript {
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
        classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE"
    }

    ext {
        a12exclusions = {
            exclude group: "org.slf4j", module: "slf4j-log4j12"
            exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl"
            exclude group: "ch.qos.logback", module: "logback-classic"
        }
    }
}

apply plugin: "java"
apply plugin: "idea"
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"

targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

dependencies {
    compile group: "org.springframework.boot", name: "spring-boot-starter-web", version: "${springBootVersion}"

    compile group: "com.mgmtp.a12.services", name: "rest-server-app", version: "${a12ServicesVersion}", a12exclusions

    compile group: "com.mgmtp.a12", name: "melies-model", version: "${a12EngineVersion}", a12exclusions
    compile group: "com.mgmtp.a12", name: "overview-model", version: "${a12EngineVersion}", a12exclusions

    compile "org.apache.solr:solr-core:6.6.0"

    compile group: "com.mgmtp.a12", name: "document-model", version: "${a12ValidationKernelVersion}", a12exclusions
    compile group: "com.mgmtp.a12", name: "document-api", version: "${a12ValidationKernelVersion}", a12exclusions
    compile group: "com.mgmtp.a12", name: "document-access", version: "${a12ValidationKernelVersion}", a12exclusions
    compile group: "com.mgmtp.a12", name: "js-document-validation", version: "${a12ValidationKernelVersion}", a12exclusions

    compile group: "javax.xml.bind", name: "jaxb-api", version: "${jaxbVersion}"
    compile group: "javax.activation", name: "activation", version: "${activationVersion}"
    compile group: "com.sun.xml.bind", name: "jaxb-impl", version: "${jaxbVersion}"
    compile group: "com.sun.xml.bind", name: "jaxb-core", version: "${jaxbVersion}"
}

task start(type: Task) {
    dependsOn(bootRun)
}

Note that setting an explicit solr version is required for some reason. Otherwise it will use solr 7.4 even if no dependencies seems to require it outside of A12

package com.mgmtp.workflow.platformserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class PlatformServer {
    public static void main(final String[] args) {
        SpringApplication.run(PlatformServer.class).start();
    }
}

Note that you have to call the start method in order to trigger a Startup Event used by A12 to initially load the models.

spring.main.allow-bean-definition-overriding: true

server.port: 9090

Setting server port and allow bean overriding (if you are past java 9) and you are good to go.