Skip to content

Commit

Permalink
Spring 5.3 & Java 17 (#196)
Browse files Browse the repository at this point in the history
* Update to spring 5.3

* Update to Java 17

* Update to Java 17 - update jacoco script

* Update to Java 17 - update github testing scripts

* Update to Java 17 - update README

* update maven war

* Update Maven Surefire to support java 17

* Update Java version in advanced-test CI/CD workflow to 17

* Update jacoco to 0.8.3 for compatability with surefire

* Update references to jacoco with 0.8.3 version

* Update jacoco to 0.8.7

* Add graalvm javascript engine

* Test

* Graalvm

* Revert, update jacoco

* Revert jacocom surefire

* Jacoco

* Re-add graalvm js

* Change to openjdk/nashorn

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Change maximum executorServiceMaxPoolSize

* Fix logic in WorkerService

* Updated README.md for Java 17

* Fixed some Java version messages

---------

Co-authored-by: James Wood <[email protected]>
  • Loading branch information
wcgunter and James Wood authored Feb 16, 2024
1 parent 2ecc894 commit 05e5612
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/camunda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down Expand Up @@ -163,10 +163,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ldap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ See the [wiki](https://github.com/NASA-AMMOS/common-workflow-service/wiki) for m

## Prerequisites

- [**Java 17 JDK**](https://formulae.brew.sh/formula/openjdk@17): CWS only runs on JDK 17. (NOTE: Cannot use JRE)
- For Homebrew users:
- Install OpenJDK 17 using: `brew install openjdk@17`
- Check the exact version installed using `/usr/libexec/java_home -V`
- Add to your Shell startup (e.g. .zprofile): `export JAVA_HOME=$(/usr/libexec/java_home -v X.X.X)`
- Replace the X.X.X version above with the OpenJDK 17 output from the `/usr/libexec/java_home -V` command.
- [**Maven**](https://maven.apache.org/download.cgi): Used to dynamically download libraries and other required project dependencies.
- For Home-brew users:
- Install Maven using: `brew install maven`
Expand All @@ -39,15 +45,9 @@ See the [wiki](https://github.com/NASA-AMMOS/common-workflow-service/wiki) for m
- You will need to add your own truststore file to this path: `install/tomcat_lib/cws_truststore.jks`
- See: https://tomcat.apache.org/tomcat-9.0-doc/ssl-howto.html
- **Store Your Keystore Password**: You will need to add your own creds file, which carries the keystore password, to this path: `~/.cws/creds`
- Set the permissions for the **~/.cws/** directory and **creds** file as Owner-Only.
- **~/.cws/** directory: `chmod 700 ~/.cws/`
- **~/.cws/creds** file: `chmod 600 ~/.cws/creds`
- **Java 11 JDK**: CWS only runs on JDK 11 now, but planning for JDK 17 soon.
- For Homebrew users:
- Install OpenJDK 11 using: `brew install openjdk@11`
- Check the exact version installed using `/usr/libexec/java_home -V`
- Add to your Shell startup (e.g. .zprofile): `export JAVA_HOME=$(/usr/libexec/java_home -v X.X.X)`
- Replace the X.X.X version above with the OpenJDK 11 output from the `/usr/libexec/java_home -V` command.
- Set the permissions for the **~/.cws/** directory and **creds** file as Owner-Only.
- **~/.cws/** directory: `chmod 700 ~/.cws/`
- **~/.cws/creds** file: `chmod 600 ~/.cws/creds`


### **Development Environment Configuration**
Expand Down
13 changes: 13 additions & 0 deletions cws-engine-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>

<!-- IS THIS NEEDED?? -->
<dependency>
<groupId>org.apache.tomcat</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ public boolean syncCounters(String reason) {
public void setJobExecutorMaxPoolSize(Integer executorServiceMaxPoolSize, boolean doDbUpdate) {
if (executorServiceMaxPoolSize != null) {
try {

// we are getting errors if we go beyond 10?
executorServiceMaxPoolSize = Math.min(10, executorServiceMaxPoolSize);
// Log information about JMX remote interface
if (System.getProperty("com.sun.management.jmxremote") == null) {
log.warn("JMX remote appears to be disabled");
Expand Down
12 changes: 12 additions & 0 deletions cws-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
<groupId>gov.nasa.jpl.ammos.ids.cws</groupId>
<artifactId>cws-adaptation-engine</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
8 changes: 3 additions & 5 deletions cws-service/src/main/java/jpl/cws/scheduler/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import static jpl.cws.core.db.SchedulerDbService.FAILED_TO_SCHEDULE;
import static jpl.cws.core.db.SchedulerDbService.PENDING;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.net.URLDecoder;
import java.sql.Timestamp;
import java.util.HashMap;
Expand Down Expand Up @@ -129,8 +127,8 @@ public SchedulerJob scheduleProcess(String procDefKey,
String procBusinessKey, String initiationKey,
int priority) throws Exception {

log.trace("Scheduling process definition '" + procDefKey + "' ...");
log.trace(" with variables=" + processVariables);
log.info("Scheduling process definition '" + procDefKey + "' ...");
log.info(" with variables=" + processVariables);

String schedulerJobUuid = null;
boolean rowCreated = false;
Expand Down
10 changes: 5 additions & 5 deletions cws-test/src/test/resources/configure_with_jacoco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ else
exit 1
fi

if [[ "$java_version" > "11" && "$java_version" < "12" ]]; then
echo " Java version == 11x [OK]"
if [[ "$java_version" > "17" && "$java_version" < "18" ]]; then
echo " Java version == 17x [OK]"
else
echo " +-------+----------------------------------------------------"
echo " | ERROR | "
echo " +-------+ "
echo " | Java version is less than 11. Must run with Java 11x "
echo " | Java version is not 17. Must run with Java 17x "
echo " | Aborting program... "
echo "--------------------------------------------------------------"
exit 1
Expand Down Expand Up @@ -264,7 +264,7 @@ rm -f ${ROOT}/config/my.cnf
sleep 1

if [ "$RECONFIGURE" = true ]; then
${JAVA_HOME}/bin/java -classpath "./installer/*" -javaagent:./server/apache-tomcat-${TOMCAT_VER}/lib/org.jacoco.agent-0.8.2-runtime.jar=destfile=./installer-jacoco.exec,append=false jpl.cws.task.CwsInstaller --reconfigure
${JAVA_HOME}/bin/java -classpath "./installer/*" -javaagent:./server/apache-tomcat-${TOMCAT_VER}/lib/org.jacoco.agent-0.8.7-runtime.jar=destfile=./installer-jacoco.exec,append=false jpl.cws.task.CwsInstaller --reconfigure
else
${JAVA_HOME}/bin/java -classpath "./installer/*" -javaagent:./server/apache-tomcat-${TOMCAT_VER}/lib/org.jacoco.agent-0.8.2-runtime.jar=destfile=./installer-jacoco.exec,append=false jpl.cws.task.CwsInstaller
${JAVA_HOME}/bin/java -classpath "./installer/*" -javaagent:./server/apache-tomcat-${TOMCAT_VER}/lib/org.jacoco.agent-0.8.7-runtime.jar=destfile=./installer-jacoco.exec,append=false jpl.cws.task.CwsInstaller
fi
4 changes: 3 additions & 1 deletion cws-ui/src/main/webapp/WEB-INF/springmvc-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

<context:property-placeholder location="classpath:cws-ui.properties"/>

<mvc:annotation-driven />
<mvc:annotation-driven>
<mvc:path-matching suffix-pattern="true" />
</mvc:annotation-driven>

<!-- <bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
Expand Down
Binary file modified install/cws_camunda-bpm-tomcat-7.20.0.zip
Binary file not shown.
29 changes: 24 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<gson.version>2.8.9</gson.version>
<h2.version>2.2.220</h2.version>
<!-- <httpclient.version>4.3</httpclient.version> -->
<jacoco.version>0.8.2</jacoco.version>
<java.version>11</java.version>
<jacoco.version>0.8.7</jacoco.version>
<java.version>17</java.version>
<javax.mail.version>1.4.7</javax.mail.version>
<jersey-client.version>2.6</jersey-client.version>
<jms.version>1.1</jms.version>
Expand Down Expand Up @@ -77,11 +77,11 @@
<log4j.version>2.17.1</log4j.version>
<slf4j-log4j2-bind.version>2.17.1</slf4j-log4j2-bind.version>
<skip.integration.tests>false</skip.integration.tests>
<spring.framework.version>5.2.20.RELEASE</spring.framework.version>
<spring.framework.version>5.3.31</spring.framework.version>
<surefire.version>2.22.2</surefire.version>
<tomcat-catalina.version>9.0.75</tomcat-catalina.version>
<urlrewritefilter.version>4.0.3</urlrewritefilter.version>
<xbean-spring.version>3.17</xbean-spring.version>
<xbean-spring.version>4.24</xbean-spring.version>
<xmlunit.version>2.6.2</xmlunit.version>
</properties>

Expand Down Expand Up @@ -109,7 +109,7 @@
<repositories>
<repository>
<id>maven2</id>
<url>http://repo1.maven.org/maven2</url>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>repository.jboss.org-public</id>
Expand Down Expand Up @@ -192,6 +192,19 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>23.0.2</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
Expand Down Expand Up @@ -658,7 +671,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
</plugins>

</build>

</project>
6 changes: 3 additions & 3 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ function check_java_requirements () {
exit 1
fi

if [[ "${JAVA_PATH_VERSION}" > "11" && "${JAVA_PATH_VERSION}" < "12" ]]; then
print " Java version == 11x [OK]"
if [[ "${JAVA_PATH_VERSION}" > "17" && "${JAVA_PATH_VERSION}" < "18" ]]; then
print " Java version == 17x [OK]"
else
print " ERROR: Java version is ${JAVA_PATH_VERSION}. CWS only supports Java version 11x."
print " ERROR: Java version is ${JAVA_PATH_VERSION}. CWS only supports Java version 17x."
exit 1
fi

Expand Down

0 comments on commit 05e5612

Please sign in to comment.