From 6cea0cc37a0c5154b0c7873a212f6bcc8ef1ba05 Mon Sep 17 00:00:00 2001 From: Ivica Loncar Date: Wed, 7 Nov 2018 15:15:24 +0100 Subject: [PATCH 1/3] GH-532 Upgrade to payara-micro 5.193.1 --- build.gradle | 4 ++- gradle.properties | 2 +- .../servers/PayaraApplicationServer.groovy | 2 +- .../devsoap/plugin/PayaraServerRunner.java | 27 +++++-------------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 74528235..50156531 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,7 @@ dependencies { implementation "org.eclipse.jetty:jetty-deploy:${project.property('jetty.version')}" //Payara application server - implementation "fish.payara.extras:payara-embedded-web:${project.property('payara.version')}" + implementation "fish.payara.extras:payara-micro:${project.property('payara.version')}" // For GET requests implementation 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' @@ -100,6 +100,8 @@ dependencies { // Sass compilation with libSass implementation "io.bit3:jsass:${project.property('jsass.version')}" + compile "javax.validation:validation-api:2.0.0.Final" + deploy 'org.apache.maven.wagon:wagon-ssh:2.2' testImplementation gradleTestKit() diff --git a/gradle.properties b/gradle.properties index 872f2672..51b60e57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ jetty.version=9.4.21.v20190926 -payara.version=5.193 +payara.version=5.193.1 jruby.version=9.2.8.0 jsass.version=5.10.0 servlet.version=3.1.0 diff --git a/src/main/groovy/com/devsoap/plugin/servers/PayaraApplicationServer.groovy b/src/main/groovy/com/devsoap/plugin/servers/PayaraApplicationServer.groovy index f66a50f4..c30c2600 100644 --- a/src/main/groovy/com/devsoap/plugin/servers/PayaraApplicationServer.groovy +++ b/src/main/groovy/com/devsoap/plugin/servers/PayaraApplicationServer.groovy @@ -121,7 +121,7 @@ class PayaraApplicationServer extends ApplicationServer { @Override void defineDependecies(DependencyHandler projectDependencies, DependencySet dependencies) { Dependency payaraWebProfile = projectDependencies.create( - "fish.payara.extras:payara-embedded-web:${Util.pluginProperties.getProperty('payara.version')}") + "fish.payara.extras:payara-micro:${Util.pluginProperties.getProperty('payara.version')}") dependencies.add(payaraWebProfile) } diff --git a/src/main/java/com/devsoap/plugin/PayaraServerRunner.java b/src/main/java/com/devsoap/plugin/PayaraServerRunner.java index 76dddf0e..6461db28 100644 --- a/src/main/java/com/devsoap/plugin/PayaraServerRunner.java +++ b/src/main/java/com/devsoap/plugin/PayaraServerRunner.java @@ -15,16 +15,13 @@ */ package com.devsoap.plugin; -import org.glassfish.embeddable.BootstrapProperties; -import org.glassfish.embeddable.Deployer; -import org.glassfish.embeddable.GlassFish; -import org.glassfish.embeddable.GlassFishProperties; -import org.glassfish.embeddable.GlassFishRuntime; - import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; +import fish.payara.micro.PayaraMicro; +import fish.payara.micro.PayaraMicroRuntime; + /** * Runner for payara * @@ -49,25 +46,15 @@ public static void main(String[] args) throws Exception { LOGGER.log(Level.INFO, "Starting Payara web server..."); try { - - BootstrapProperties bootstrap = new BootstrapProperties(); - - GlassFishRuntime runtime = GlassFishRuntime.bootstrap(bootstrap, - PayaraServerRunner.class.getClass().getClassLoader()); - - GlassFishProperties glassfishProperties = new GlassFishProperties(); - glassfishProperties.setPort("http-listener", port); + PayaraMicro micro = PayaraMicro.getInstance(); + micro.setHttpPort(port); LOGGER.log(Level.INFO, "Running on port "+port); - GlassFish glassfish = runtime.newGlassFish(glassfishProperties); - glassfish.start(); - - Deployer deployer = glassfish.getDeployer(); - File work = new File(workdir); File explodedWar = new File(work, "war"); - deployer.deploy(explodedWar, "--contextroot="); + PayaraMicroRuntime runtime = micro.bootstrap(); + runtime.deploy(explodedWar); } catch (Exception ex){ LOGGER.log(Level.SEVERE, "Failed to start Payara server", ex); From ce3033b749c29e0fab753269f96680d358f755a5 Mon Sep 17 00:00:00 2001 From: gialiguori <43948310+gialiguori@users.noreply.github.com> Date: Mon, 8 Oct 2018 10:09:14 +0200 Subject: [PATCH 2/3] Update JettyServerRunner.java Setting ParentLoaderPriority to true seem to cause classes in dependency jar to be loaded by the system class loader and not by the webapp one. Causing conflict error when try to perform reflection operations with web app loaded classes. If you set it to false (the default), Jetty uses standard webapp classloading priority. --- src/main/java/com/devsoap/plugin/JettyServerRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/devsoap/plugin/JettyServerRunner.java b/src/main/java/com/devsoap/plugin/JettyServerRunner.java index 4a7f292c..71ae7ad9 100644 --- a/src/main/java/com/devsoap/plugin/JettyServerRunner.java +++ b/src/main/java/com/devsoap/plugin/JettyServerRunner.java @@ -76,7 +76,7 @@ public static void main(String[] args) throws Exception { handler.setContextPath("/"); handler.setBaseResource(Resource.newResource(webAppDir)); - handler.setParentLoaderPriority(true); + handler.setParentLoaderPriority(false); handler.setExtraClasspath(String.join(";", classesDirs) + ";" + resourcesDir); From 0c58ae7ba72db3e5772baf00c9a87010cefb83fa Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Wed, 9 Oct 2019 20:11:18 +0200 Subject: [PATCH 3/3] Run tests on all recent jdk versions. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index f8940f50..65007390 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ dist: xenial language: groovy jdk: - openjdk8 + - openjdk9 + - openjdk10 + - openjdk11 + - openjdk12 env: - TEST_CATEGORY=uncategorizedTests - TEST_CATEGORY=widgetsetCompileTests