diff --git a/api-catalog-services/src/main/resources/application.yml b/api-catalog-services/src/main/resources/application.yml index a9d59f6fbc..870fcfbda6 100644 --- a/api-catalog-services/src/main/resources/application.yml +++ b/api-catalog-services/src/main/resources/application.yml @@ -7,6 +7,9 @@ spring: client: hostname: ${apiml.service.hostname} ipAddress: ${apiml.service.ipAddress} + gateway: + mvc.enabled: false + enabled: false mvc: throw-exception-if-no-handler-found: true output: @@ -15,6 +18,7 @@ spring: main: allow-circular-references: true banner-mode: ${apiml.banner:"off"} + web-application-type: servlet profiles.group: dev: debug, diag diff --git a/build.gradle b/build.gradle index 796b81ece5..f68f81fe00 100644 --- a/build.gradle +++ b/build.gradle @@ -34,10 +34,12 @@ buildscript { } } -import java.util.regex.Matcher + +import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry import org.gradle.plugins.ide.eclipse.model.AccessRule import org.gradle.plugins.ide.eclipse.model.ClasspathEntry -import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry + +import java.util.regex.Matcher //noinspection GroovyAssignabilityCheck group 'org.zowe.apiml' @@ -95,6 +97,22 @@ allprojects { } +configure(subprojects.findAll { it.name in [ + 'apiml-common-lib-package', + 'api-catalog-services', + 'caching-service', + 'discovery-service', + 'gateway-service', + 'zaas-service' +]}) { + + configurations.all { + // it has been replaced by spring-jcl + exclude group: "commons-logging", module: "commons-logging" + } + +} + configure(subprojects.findAll {it.name != 'platform'}) { apply plugin: 'java-library' diff --git a/caching-service/src/main/resources/application.yml b/caching-service/src/main/resources/application.yml index 14d934e62b..e8fd57aa74 100644 --- a/caching-service/src/main/resources/application.yml +++ b/caching-service/src/main/resources/application.yml @@ -110,6 +110,9 @@ spring: cloud: compatibilityVerifier: enabled: false # Should be removed when upgrade to Spring Cloud 3.x + gateway: + mvc.enabled: false + enabled: false application: name: Caching service mvc: @@ -119,6 +122,7 @@ spring: main: allow-circular-references: true banner-mode: ${apiml.banner:"off"} + web-application-type: servlet springdoc: pathsToMatch: /api/v1/** diff --git a/discovery-service/src/main/resources/application.yml b/discovery-service/src/main/resources/application.yml index 7d83c76ed0..21222b4332 100644 --- a/discovery-service/src/main/resources/application.yml +++ b/discovery-service/src/main/resources/application.yml @@ -49,12 +49,16 @@ spring: client: hostname: ${apiml.service.hostname} ipAddress: ${apiml.service.ipAddress} + gateway: + mvc.enabled: false + enabled: false output: ansi: enabled: detect main: banner-mode: ${apiml.banner:"off"} allow-circular-references: true + web-application-type: servlet profiles.group: dev: debug, diag diff --git a/gateway-package/src/main/resources/bin/start.sh b/gateway-package/src/main/resources/bin/start.sh index e1a1a1ad7e..9a52a3f287 100755 --- a/gateway-package/src/main/resources/bin/start.sh +++ b/gateway-package/src/main/resources/bin/start.sh @@ -84,13 +84,20 @@ if [ -n "${LAUNCH_COMPONENT}" ] then - JAR_FILE="${LAUNCH_COMPONENT}/gateway-service.jar" + JAR_FILE="${LAUNCH_COMPONENT}/gateway-service-lite.jar" else - JAR_FILE="$(pwd)/bin/gateway-service.jar" + JAR_FILE="$(pwd)/bin/gateway-service-lite.jar" fi echo "jar file: "${JAR_FILE} # script assumes it's in the gateway component directory and common_lib needs to be relative path +if [ -z "${CMMN_LB}" ] +then + COMMON_LIB="../apiml-common-lib/bin/api-layer-lite-lib-all.jar" +else + COMMON_LIB=${CMMN_LB} +fi + if [ -z "${LIBRARY_PATH}" ] then LIBRARY_PATH="../common-java-lib/bin/" @@ -122,6 +129,22 @@ else nonStrictVerifySslCertificatesOfServices=false fi +if [ "$(uname)" = "OS/390" ] +then + QUICK_START=-Xquickstart + GATEWAY_LOADER_PATH=${COMMON_LIB},/usr/include/java_classes/IRRRacf.jar +else + GATEWAY_LOADER_PATH=${COMMON_LIB} +fi + +# Check if the directory containing the ZAAS shared JARs was set and append it to the ZAAS loader path +if [ -n "${ZWE_GATEWAY_SHARED_LIBS}" ] +then + GATEWAY_LOADER_PATH=${ZWE_GATEWAY_SHARED_LIBS},${GATEWAY_LOADER_PATH} +fi + +echo "Setting loader path: "${GATEWAY_LOADER_PATH} + ATTLS_ENABLED="false" # ZWE_configs_spring_profiles_active for back compatibility, should be removed in v3 - enabling via Spring profile if [ "${ZWE_zowe_network_server_tls_attls}" = "true" -o "$(echo ${ZWE_configs_spring_profiles_active:-} | awk '/^(.*,)?attls(,.*)?$/')" ]; then @@ -148,15 +171,6 @@ else externalProtocol="http" fi -GATEWAY_LOADER_PATH="" -# Check if the directory containing the ZAAS shared JARs was set and append it to the ZAAS loader path -if [ -n "${ZWE_GATEWAY_SHARED_LIBS}" ] -then - GATEWAY_LOADER_PATH=${ZWE_GATEWAY_SHARED_LIBS} -fi - -echo "Setting loader path: "${GATEWAY_LOADER_PATH} - LIBPATH="$LIBPATH":"/lib" LIBPATH="$LIBPATH":"/usr/lib" LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin @@ -167,6 +181,11 @@ LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390/default LIBPATH="$LIBPATH":"${JAVA_HOME}"/lib/s390/j9vm LIBPATH="$LIBPATH":"${LIBRARY_PATH}" +if [ -n "${ZWE_GATEWAY_LIBRARY_PATH}" ] +then + LIBPATH="$LIBPATH":"${ZWE_GATEWAY_LIBRARY_PATH}" +fi + ADD_OPENS="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED @@ -319,6 +338,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${GATEWAY_CODE} ${JAVA_BIN_DIR}java \ -Djdk.tls.client.cipherSuites=${client_ciphers} \ -Djava.protocol.handler.pkgs=com.ibm.crypto.provider \ -Djavax.net.debug=${ZWE_configs_sslDebug:-""} \ + -Dloader.path=${GATEWAY_LOADER_PATH} \ -Djava.library.path=${LIBPATH} \ -Dloader.path=${GATEWAY_LOADER_PATH} \ -jar ${JAR_FILE} & diff --git a/gateway-service/build.gradle b/gateway-service/build.gradle index f419549a99..64ca7d57e6 100644 --- a/gateway-service/build.gradle +++ b/gateway-service/build.gradle @@ -18,6 +18,7 @@ normalization { } apply plugin: 'org.springframework.boot' +apply from: "$projectDir/gradle/lite.gradle" apply plugin: 'com.google.cloud.tools.jib' apply from: "../gradle/jib.gradle" @@ -82,7 +83,7 @@ dependencies { implementation libs.swagger2.parser implementation libs.swagger3.parser - implementation libs.jaxbApi + implementation libs.bundles.jaxb testImplementation libs.spring.boot.starter.test testImplementation libs.spring.mock.mvc diff --git a/gateway-service/gradle/lite.gradle b/gateway-service/gradle/lite.gradle new file mode 100644 index 0000000000..5f9f17f21a --- /dev/null +++ b/gateway-service/gradle/lite.gradle @@ -0,0 +1,64 @@ +import org.springframework.boot.gradle.tasks.bundling.BootJar + +/** + * This gradle file extends task `build` to create thin JAR files: + * -lite.jar - contains base SpringBoot part to be executable and built submodules + * -lite-lib.jar - contains all external libraries (except modules) + * + * To run application with thin and library file use: + * java -Dloader.path=-lite-lib-.jar -jar -lite-.jar + * + * Example: + * java -Dloader.path=zowe-rest-api-sample-spring-lite-lib-0.0.1-SNAPSHOT.jar -jar zowe-rest-api-sample-spring-lite-0.0.1-SNAPSHOT.jar + */ + + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath libs.spring.boot.gradle.plugin + } +} + +apply from: "$rootDir/gradle/lite-project.gradle" + +task liteJar(type: BootJar) { + //Do not allow duplicates by ignoring subsequent items to be created at the same path. + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + targetJavaVersion = JavaVersion.VERSION_17 + manifest { + attributes 'Main-Class': 'org.springframework.boot.loader.launch.PropertiesLauncher' + } + def modulesJar = getModulesJarNames() + archiveFileName = getBaseNameLite() + ".jar" + mainClass = getSpringBootApp() + exclude { details -> details.file && details.file.name.endsWith('.jar') && !modulesJar.contains(details.file.name) } + with bootJar + + archiveClassifier = "lite" +} + +configurations { + liteJarConfiguration +} + +artifacts { + liteJarConfiguration(liteJar) { + builtBy(liteJar) + } +} +task liteLibJar(type: Jar) { + archiveFileName = getBaseNameLite() + "-lib.jar" + entryCompression = ZipEntryCompression.STORED + from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }} + include '*.jar' + exclude getModulesJarFilters() + with bootJar + + archiveClassifier = "lite-lib" +} + +jar.dependsOn liteLibJar +jar.dependsOn liteJar diff --git a/gateway-service/src/main/resources/application.yml b/gateway-service/src/main/resources/application.yml index dd773ffbc5..c518cac452 100644 --- a/gateway-service/src/main/resources/application.yml +++ b/gateway-service/src/main/resources/application.yml @@ -64,6 +64,7 @@ spring: redirectUri: "{baseUrl}/gateway/{action}/oauth2/code/{registrationId}" main: banner-mode: ${apiml.banner:"off"} + web-application-type: reactive springdoc: api-docs: diff --git a/gradle/lite.gradle b/gradle/lite.gradle index 439fc16346..3df8a0675c 100644 --- a/gradle/lite.gradle +++ b/gradle/lite.gradle @@ -54,6 +54,7 @@ task liteLibJarAll(type: Jar) { } liteLibJarAll.dependsOn(":zaas-service:build") +liteLibJarAll.dependsOn(":gateway-service:build") liteLibJarAll.dependsOn(":discovery-service:build") liteLibJarAll.dependsOn(":api-catalog-services:build") diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 0ea5532307..d26c968303 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -14,22 +14,27 @@ dependencyResolutionManagement { version('springFramework', '6.1.13') version('springRetry', '2.0.9') + version('glassfishHk2', '3.1.1') version('zosUtils', '2.0.5') version('aws', '1.12.772') version('awaitility', '4.2.2') version('bouncyCastle', '1.78.1') version('caffeine', '3.1.8') + version('checkerQual', '3.43.0') version('commonsLang3', '3.17.0') + version('commonsLogging', '1.3.4') version('commonsText', '1.12.0') version('commonsIo', '2.17.0') version('ehCache', '3.10.8') version('eureka', '2.0.3') version('netflixServo', '0.13.2') + version('googleErrorprone', '2.32.0') version('gradleGitProperties', '2.4.2') // Used in classpath dependencies version('gradleNode', '3.6.0') // Used in classpath dependencies version('guava', '33.3.1-jre') // version('hamcrest', '1.3') version('hamcrest', '2.2') + version('httpClient4', '4.5.14') version('httpClient5', '5.4') version('infinispan', '15.0.8.Final') version('jacksonCore', '2.17.2') @@ -39,6 +44,7 @@ dependencyResolutionManagement { version('jakartaValidation', '3.1.0') version('jakartaInject', '2.0.1') version('jakartaServlet', '6.1.0') + version('javaxAnnotation', '1.3.2') version('jaxbApi') { strictly '[2.3.3,3.0.0[' prefer '2.3.3' @@ -47,11 +53,13 @@ dependencyResolutionManagement { strictly '[2.3.9,3.0.0[' prefer '2.3.9' } + version('jbossLogging', '3.6.0.Final') version('jerseySun', '1.19.4') version('jettyWebSocketClient', '9.4.56.v20240826') version('jettison', '1.5.4') //0.12.x version contains breaking changes version('jjwt', '0.12.6') + version('jodaTime', '2.12.7') version('jsonPath', '2.9.0') version('jsonSmart', '2.5.1') version('junitJupiter', '5.11.0') @@ -133,20 +141,27 @@ dependencyResolutionManagement { library('spring_beans', 'org.springframework', 'spring-beans').versionRef('springFramework') library('apache_commons_lang3', 'org.apache.commons', 'commons-lang3').versionRef('commonsLang3') + library('apache_commons_logging', 'commons-logging', 'commons-logging').versionRef('commonsLogging') // to define minimum version and avoid duplicity libraries in the classpath library('apache_commons_text', 'org.apache.commons', 'commons-text').versionRef('commonsText') + library('aopalliance', 'org.glassfish.hk2.external', 'aopalliance-repackaged').versionRef('glassfishHk2') // to define minimum version and avoid duplicity libraries in the classpath + library('hk2_api', 'org.glassfish.hk2', 'hk2-api').versionRef('glassfishHk2') // to define minimum version and avoid duplicity libraries in the classpath library('apache_velocity', 'org.apache.velocity', 'velocity-engine-core').versionRef('velocity') library('awaitility', 'org.awaitility', 'awaitility').versionRef('awaitility') library('aws_bom', 'com.amazonaws', 'aws-java-sdk-bom').versionRef('aws') library('bcprov', 'org.bouncycastle', 'bcprov-jdk18on').versionRef('bouncyCastle') library('bcpkix', 'org.bouncycastle', 'bcpkix-jdk18on').versionRef('bouncyCastle') library('caffeine', 'com.github.ben-manes.caffeine', 'caffeine').versionRef('caffeine') + library('checker_qual', 'org.checkerframework', 'checker-qual').versionRef('checkerQual') library('commons_io', 'commons-io', 'commons-io').versionRef('commonsIo') library('eh_cache', 'org.ehcache', 'ehcache').versionRef('ehCache') library('eureka_jersey_client', 'com.netflix.eureka', 'eureka-client-jersey3').versionRef('eureka') + library('google_errorprone', 'com.google.errorprone', 'error_prone_annotations').versionRef('googleErrorprone') // to define minimum version and avoid duplicity libraries in the classpath library('guava', 'com.google.guava', 'guava').versionRef('guava') library('hamcrest', 'org.hamcrest', 'hamcrest').versionRef('hamcrest') + library('http_client4', 'org.apache.httpcomponents', 'httpclient').versionRef('httpClient4') // to define minimum version and avoid duplicity libraries in the classpath library('http_client5', 'org.apache.httpcomponents.client5', 'httpclient5').versionRef('httpClient5') + library('javax_annotation', 'javax.annotation', 'javax.annotation-api').versionRef('javaxAnnotation') // to define minimum version and avoid duplicity libraries in the classpath library('netflix_servo', 'com.netflix.servo', 'servo-core').versionRef('netflixServo') library('infinispan_spring_boot3_starter_embedded', 'org.infinispan', 'infinispan-spring-boot3-starter-embedded').versionRef('infinispan') @@ -162,6 +177,7 @@ dependencyResolutionManagement { library('jakarta_servlet_api', 'jakarta.servlet', 'jakarta.servlet-api').versionRef('jakartaServlet') library('jaxbApi', 'jakarta.xml.bind', 'jakarta.xml.bind-api').versionRef('jaxbApi') library('jaxbImpl', 'com.sun.xml.bind', 'jaxb-impl').versionRef('jaxbImpl') + library('jboss_logging', 'org.jboss.logging', 'jboss-logging').versionRef('jbossLogging') // to define minimum version and avoid duplicity libraries in the classpath library('jetty_client', 'org.eclipse.jetty', 'jetty-client').versionRef('jettyWebSocketClient') library('jetty_http', 'org.eclipse.jetty', 'jetty-http').versionRef('jettyWebSocketClient') library('jetty_io', 'org.eclipse.jetty', 'jetty-io').versionRef('jettyWebSocketClient') @@ -170,6 +186,7 @@ dependencyResolutionManagement { library('jetty_websocket_client', 'org.eclipse.jetty.websocket', 'websocket-client').versionRef('jettyWebSocketClient') library('jetty_websocket_common', 'org.eclipse.jetty.websocket', 'websocket-common').versionRef('jettyWebSocketClient') library('jettison', 'org.codehaus.jettison', 'jettison').versionRef('jettison') + library('joda_time', 'joda-time', 'joda-time').versionRef('jodaTime') // to define minimum version and avoid duplicity libraries in the classpath library('json_smart', 'net.minidev', 'json-smart').versionRef('jsonSmart') library('jjwt', 'io.jsonwebtoken', 'jjwt-api').versionRef('jjwt') library('jjwt_impl', 'io.jsonwebtoken', 'jjwt-impl').versionRef('jjwt') @@ -222,6 +239,7 @@ dependencyResolutionManagement { library('gradle_jib_plugin', 'gradle.plugin.com.google.cloud.tools', 'jib-gradle-plugin').versionRef('gradleJibPlugin') library('gradle_test_logger', 'com.adarshr', 'gradle-test-logger-plugin').versionRef('gradleTestLogger') library('micronaut_http_client', 'io.micronaut', 'micronaut-http-client').versionRef('micronaut') + library('micronaut_bom', 'io.micronaut', 'micronaut-core-bom').versionRef('micronaut') library('apache_compress', 'org.apache.commons', 'commons-compress').versionRef('commonsCompress') plugin('gradle_git_properties', 'com.gorylenko.gradle-git-properties').versionRef('gradleGitProperties') diff --git a/platform/build.gradle b/platform/build.gradle index 62c69d2aba..5b278f4cc7 100644 --- a/platform/build.gradle +++ b/platform/build.gradle @@ -19,6 +19,7 @@ dependencies { api(platform(libs.spring.boot.dependencies)) api(platform(libs.netty.bom)) api(platform(libs.aws.bom)) + api(platform(libs.micronaut.bom)) constraints { // to define preferred version (the minimal version constraints) diff --git a/zaas-package/src/main/resources/bin/start.sh b/zaas-package/src/main/resources/bin/start.sh index a0a0485f20..82c685dc8c 100755 --- a/zaas-package/src/main/resources/bin/start.sh +++ b/zaas-package/src/main/resources/bin/start.sh @@ -138,6 +138,14 @@ else ZAAS_LOADER_PATH=${COMMON_LIB} fi +# Check if the directory containing the ZAAS shared JARs was set and append it to the ZAAS loader path +if [ -n "${ZWE_ZAAS_SHARED_LIBS}" ] +then + ZAAS_LOADER_PATH=${ZWE_ZAAS_SHARED_LIBS},${ZAAS_LOADER_PATH} +fi + +echo "Setting loader path: "${ZAAS_LOADER_PATH} + ATTLS_ENABLED="false" # ZWE_configs_spring_profiles_active for back compatibility, should be removed in v3 - enabling via Spring profile if [ "${ZWE_zowe_network_server_tls_attls}" = "true" -o "$(echo ${ZWE_configs_spring_profiles_active:-} | awk '/^(.*,)?attls(,.*)?$/')" ]; then @@ -163,14 +171,6 @@ else externalProtocol="http" fi -# Check if the directory containing the ZAAS shared JARs was set and append it to the ZAAS loader path -if [ -n "${ZWE_ZAAS_SHARED_LIBS}" ] -then - ZAAS_LOADER_PATH=${ZWE_ZAAS_SHARED_LIBS},${ZAAS_LOADER_PATH} -fi - -echo "Setting loader path: "${ZAAS_LOADER_PATH} - LIBPATH="$LIBPATH":"/lib" LIBPATH="$LIBPATH":"/usr/lib" LIBPATH="$LIBPATH":"${JAVA_HOME}"/bin diff --git a/zaas-service/build.gradle b/zaas-service/build.gradle index 1c2677591a..9d8598526c 100644 --- a/zaas-service/build.gradle +++ b/zaas-service/build.gradle @@ -70,6 +70,7 @@ dependencies { implementation libs.jackson.annotations implementation libs.jackson.core implementation libs.jackson.databind + implementation libs.jaxbApi implementation libs.spring.cloud.commons implementation libs.jjwt implementation libs.nimbus.jose.jwt @@ -86,7 +87,9 @@ dependencies { implementation libs.spring.webmvc implementation libs.spring.webflux - implementation libs.eh.cache + implementation(libs.eh.cache) { + exclude group: "jakarta.xml.bind", module: "jakarta.xml.bind-api" + } implementation libs.bundles.jaxb diff --git a/zaas-service/src/main/resources/application.yml b/zaas-service/src/main/resources/application.yml index 10edb7ed2f..6383df8bf0 100644 --- a/zaas-service/src/main/resources/application.yml +++ b/zaas-service/src/main/resources/application.yml @@ -101,6 +101,9 @@ spring: client: hostname: ${apiml.service.hostname} ipAddress: ${apiml.service.ipAddress} + gateway: + mvc.enabled: false + enabled: false mvc: throw-exception-if-no-handler-found: false # to suppress NoHandlerFoundException: No handler found for GET /error, we already provide error handling for requests log-resolved-exception: false # Suppress useless logs from AbstractHandlerExceptionResolver @@ -112,6 +115,7 @@ spring: main: banner-mode: ${apiml.banner:"off"} allow-circular-references: true + web-application-type: servlet springdoc: writer-with-order-by-keys: true