From 35844dbf28f0f9e389bd6e7db9eec40cad15dcdf Mon Sep 17 00:00:00 2001 From: Christopher Broderick Date: Tue, 1 Oct 2024 23:47:36 +0100 Subject: [PATCH] Javax to jakarta cleanup plus other stuff (#393) * Move to Kakarta library for mail annotations and REST (JAX-RS) * Update to Jakarta libraries * Initial upgrade notes * Use the latest versions of github actions modules * Add useful info for the problematic current WebUI implementation * Use V3 for Java 8 compat * Downgrade jakarta.ws.rs to V3.x for Java compile version --- .github/workflows/actions.yml | 6 +- README.md | 1 + RELEASE-NOTES.md | 21 +++--- Server/pom.xml | 70 ++++++------------- Server/src/config/config.xml | 4 +- .../java/org/openas2/app/OpenAS2Server.java | 2 +- .../cmd/processor/BaseCommandProcessor.java | 2 +- .../cmd/processor/restapi/ApiResource.java | 2 +- .../java/org/openas2/lib/CryptoException.java | 24 ------- .../java/org/openas2/lib/MDNException.java | 24 ------- .../org/openas2/lib/OpenAS2Exception.java | 24 ------- .../java/org/openas2/logging/LogManager.java | 2 +- .../org/openas2/message/BaseMessageMDN.java | 2 +- .../msgtracking/EmbeddedDBHandler.java | 2 +- .../openas2/processor/receiver/NetModule.java | 2 +- .../java/org/openas2/support/FileMonitor.java | 2 +- .../org/openas2/app/OpenAS2ServerTest.java | 2 +- WebUI/README.md | 5 ++ changes.txt | 9 ++- pom.xml | 20 ++---- 20 files changed, 66 insertions(+), 160 deletions(-) delete mode 100644 Server/src/main/java/org/openas2/lib/CryptoException.java delete mode 100644 Server/src/main/java/org/openas2/lib/MDNException.java delete mode 100644 Server/src/main/java/org/openas2/lib/OpenAS2Exception.java diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0a0fca05..39a69172 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -10,9 +10,9 @@ jobs: os: [windows-latest, ubuntu-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java_version }} - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java_version }} distribution: 'adopt' @@ -48,7 +48,7 @@ jobs: ./mvnw clean -e --debug --file pom.xml --log-file maven.log ./mvnw test -e --debug --file pom.xml --log-file maven.log - name: Archive logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: execution-logs-${{ matrix.java_version }}-${{ matrix.os }} diff --git a/README.md b/README.md index dbde6d6a..4527a911 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ $ docker build -t openas2:latest . ``` Run the OpenAS2 server, with its network set to "host", so that the WebUI can access the server. +NOTE: Some users have reported that using --net=host does not work for them and removing it solves the problem.. ```console $ docker run -it --rm --net=host -p 4080:10080 -p 4081:10081 -p 8443:8080 -v ${PWD}/config:/opt/openas2/config -v ${PWD}/data:/opt/openas2/data openas2:latest diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9464754d..4e8baa3b 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,26 +1,29 @@ # OpenAS2 Server -# Version 3.11.0 +# Version 3.12.0 # RELEASE NOTES ----- -The OpenAS2 project is pleased to announce the release of OpenAS2 3.11.0 +The OpenAS2 project is pleased to announce the release of OpenAS2 3.12.0 -The release download file is: OpenAS2Server-3.11.0.zip +The release download file is: OpenAS2Server-3.12.0.zip The zip file contains a PDF document (OpenAS2HowTo.pdf) providing information on installing and using the application. ## NOTE: Testing covers Java 8 to 17. See Java Compatibility section of the OpenAS2 documentation for using Java 8. -Version 3.11.0 - 2024-08-22 -This is a minor bugfix release: +Version 3.12.0 - 2024-10-15 +This is a minor enhancement and bugfix release: **IMPORTANT NOTE**: Please review upgrade notes below if you are upgrading -1. Enhance the handling of MDN processing and asociated resend handling to provide moer reliable error handling. -2. Enhance the Disposition-Notification-Options handler to properly support the standard. -3. Use the LTS releases of Java for testing -4. Use a SQL-92 compliant SQL format for accessing the database. +1. Change the property name in config.xml from javax.mail.properties to jakarta.mail.properties +2. ##Upgrade Notes See the openAS2HowTo appendix for the general process on upgrading OpenAS2. +### Upgrading to 3.12 or newer any older version: + 1. The property in the config.xml changed: + Change ALL occurrences of javax.mail.properties to jakarta.mail.properties in config.xml and the .properties file if you implemented it. + 2. Completely replace all library files in the existing "lib" folder wit hthe ones supplied in the new install package (per recommended standard procedure in the user guide). + ### Upgrading to 3.6 or newer from 3.5 (or older) version: 1. Run the following command after the upgrade of the code base is complete and BEFORE you start the OpenAS2 server: - Open a shell (Command prompt or Powershell in Windows or a Terminal window in NIX systems) diff --git a/Server/pom.xml b/Server/pom.xml index 268aeb6b..787d3769 100644 --- a/Server/pom.xml +++ b/Server/pom.xml @@ -204,40 +204,6 @@ org.apache.httpcomponents httpclient - - com.google.code.findbugs - findbugs - - - xml-apis - xml-apis - - - jaxen - jaxen - - - - - org.junit.jupiter - junit-jupiter - test - - - org.hamcrest - hamcrest - test - - - org.mockito - mockito-core - test - - - org.mockito - mockito-junit-jupiter - test - commons-io commons-io @@ -274,29 +240,33 @@ jakarta.xml.bind jakarta.xml.bind-api - - com.sun.xml.bind - jaxb-core + + jakarta.ws.rs + jakarta.ws.rs-api + + + jakarta.annotation + jakarta.annotation-api - com.sun.xml.bind - jaxb-impl + org.junit.jupiter + junit-jupiter + test - - - javax.ws.rs - javax.ws.rs-api + org.mockito + mockito-junit-jupiter + test - - - javax.annotation - javax.annotation-api + + org.mockito + mockito-core + test diff --git a/Server/src/config/config.xml b/Server/src/config/config.xml index 6dbc3142..47fd7bdc 100644 --- a/Server/src/config/config.xml +++ b/Server/src/config/config.xml @@ -50,7 +50,7 @@ ssl_keystore="%home%/ssl_certs.jks" ssl_keystore_password="testas2" partnership_file="%home%/partnerships.xml" - javax.mail.properties.file="%home%/java.mail.properties" + jakarta.mail.properties.file="%home%/java.mail.properties" email.from="Open AS2 Server<as2msgs@openas2.org>" email.to="your email address" email.smtpserver="mail.openas2.org" @@ -97,7 +97,7 @@ enabled="$properties.email.logger.enabled$" only_active_msg_transfer_errors="$properties.email.logger.only_active_msg_transfer_errors$" log_exception_trace="properties.email.logger.log_exception_trace$" - javax.mail.properties.file="$properties.javax.mail.properties.file$" + jakarta.mail.properties.file="$properties.jakarta.mail.properties.file$" from="$properties.email.from$" to="$properties.email.to$" smtpserver="$properties.email.smtpserver$" diff --git a/Server/src/main/java/org/openas2/app/OpenAS2Server.java b/Server/src/main/java/org/openas2/app/OpenAS2Server.java index c7fe866c..4639944c 100644 --- a/Server/src/main/java/org/openas2/app/OpenAS2Server.java +++ b/Server/src/main/java/org/openas2/app/OpenAS2Server.java @@ -7,7 +7,7 @@ import org.openas2.XMLSession; import org.openas2.lib.helper.ICryptoHelper; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import javax.crypto.Cipher; import java.io.File; import java.io.IOException; diff --git a/Server/src/main/java/org/openas2/cmd/processor/BaseCommandProcessor.java b/Server/src/main/java/org/openas2/cmd/processor/BaseCommandProcessor.java index 592c6a61..7fe6ecd2 100644 --- a/Server/src/main/java/org/openas2/cmd/processor/BaseCommandProcessor.java +++ b/Server/src/main/java/org/openas2/cmd/processor/BaseCommandProcessor.java @@ -8,7 +8,7 @@ import org.openas2.cmd.CommandRegistry; import org.openas2.schedule.HasSchedule; -import javax.annotation.Nullable; +import jakarta.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/Server/src/main/java/org/openas2/cmd/processor/restapi/ApiResource.java b/Server/src/main/java/org/openas2/cmd/processor/restapi/ApiResource.java index b41f3ae5..b4a985bc 100644 --- a/Server/src/main/java/org/openas2/cmd/processor/restapi/ApiResource.java +++ b/Server/src/main/java/org/openas2/cmd/processor/restapi/ApiResource.java @@ -11,7 +11,7 @@ import org.openas2.cmd.CommandResult; import org.openas2.cmd.processor.RestCommandProcessor; -import javax.annotation.security.RolesAllowed; +import jakarta.annotation.security.RolesAllowed; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; diff --git a/Server/src/main/java/org/openas2/lib/CryptoException.java b/Server/src/main/java/org/openas2/lib/CryptoException.java deleted file mode 100644 index 6dc6d194..00000000 --- a/Server/src/main/java/org/openas2/lib/CryptoException.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openas2.lib; - -public class CryptoException extends OpenAS2Exception { - /** - * - */ - private static final long serialVersionUID = 1L; - - public CryptoException() { - super(); - } - - public CryptoException(String msg) { - super(msg); - } - - public CryptoException(String msg, Throwable cause) { - super(msg, cause); - } - - public CryptoException(Throwable cause) { - super(cause); - } -} diff --git a/Server/src/main/java/org/openas2/lib/MDNException.java b/Server/src/main/java/org/openas2/lib/MDNException.java deleted file mode 100644 index 336e7856..00000000 --- a/Server/src/main/java/org/openas2/lib/MDNException.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openas2.lib; - -public class MDNException extends OpenAS2Exception { - /** - * - */ - private static final long serialVersionUID = 1L; - - public MDNException() { - super(); - } - - public MDNException(String msg) { - super(msg); - } - - public MDNException(String msg, Throwable cause) { - super(msg, cause); - } - - public MDNException(Throwable cause) { - super(cause); - } -} diff --git a/Server/src/main/java/org/openas2/lib/OpenAS2Exception.java b/Server/src/main/java/org/openas2/lib/OpenAS2Exception.java deleted file mode 100644 index ae3eccc0..00000000 --- a/Server/src/main/java/org/openas2/lib/OpenAS2Exception.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openas2.lib; - -public class OpenAS2Exception extends Exception { - /** - * - */ - private static final long serialVersionUID = 1L; - - public OpenAS2Exception() { - super(); - } - - public OpenAS2Exception(String msg) { - super(msg); - } - - public OpenAS2Exception(String msg, Throwable cause) { - super(msg, cause); - } - - public OpenAS2Exception(Throwable cause) { - super(cause); - } -} diff --git a/Server/src/main/java/org/openas2/logging/LogManager.java b/Server/src/main/java/org/openas2/logging/LogManager.java index 537c628c..f9c797fa 100644 --- a/Server/src/main/java/org/openas2/logging/LogManager.java +++ b/Server/src/main/java/org/openas2/logging/LogManager.java @@ -2,7 +2,7 @@ import org.openas2.message.Message; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/Server/src/main/java/org/openas2/message/BaseMessageMDN.java b/Server/src/main/java/org/openas2/message/BaseMessageMDN.java index 5f0b4420..55adb10e 100644 --- a/Server/src/main/java/org/openas2/message/BaseMessageMDN.java +++ b/Server/src/main/java/org/openas2/message/BaseMessageMDN.java @@ -3,7 +3,7 @@ import org.openas2.params.InvalidParameterException; import org.openas2.partner.Partnership; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import jakarta.mail.Header; import jakarta.mail.MessagingException; import jakarta.mail.internet.InternetHeaders; diff --git a/Server/src/main/java/org/openas2/processor/msgtracking/EmbeddedDBHandler.java b/Server/src/main/java/org/openas2/processor/msgtracking/EmbeddedDBHandler.java index 5fd8c873..139f0147 100644 --- a/Server/src/main/java/org/openas2/processor/msgtracking/EmbeddedDBHandler.java +++ b/Server/src/main/java/org/openas2/processor/msgtracking/EmbeddedDBHandler.java @@ -6,7 +6,7 @@ import org.h2.tools.Server; import org.openas2.OpenAS2Exception; -import javax.annotation.Nullable; +import jakarta.annotation.Nullable; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; diff --git a/Server/src/main/java/org/openas2/processor/receiver/NetModule.java b/Server/src/main/java/org/openas2/processor/receiver/NetModule.java index 096e2d47..465c71de 100644 --- a/Server/src/main/java/org/openas2/processor/receiver/NetModule.java +++ b/Server/src/main/java/org/openas2/processor/receiver/NetModule.java @@ -17,7 +17,7 @@ import org.openas2.util.Properties; import org.openas2.util.ResponseWrapper; -import javax.annotation.Nullable; +import jakarta.annotation.Nullable; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocketFactory; diff --git a/Server/src/main/java/org/openas2/support/FileMonitor.java b/Server/src/main/java/org/openas2/support/FileMonitor.java index f5780381..edd565ed 100644 --- a/Server/src/main/java/org/openas2/support/FileMonitor.java +++ b/Server/src/main/java/org/openas2/support/FileMonitor.java @@ -1,6 +1,6 @@ package org.openas2.support; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.io.File; import java.util.Date; import java.util.LinkedList; diff --git a/Server/src/test/java/org/openas2/app/OpenAS2ServerTest.java b/Server/src/test/java/org/openas2/app/OpenAS2ServerTest.java index 8e62f117..901a0efc 100644 --- a/Server/src/test/java/org/openas2/app/OpenAS2ServerTest.java +++ b/Server/src/test/java/org/openas2/app/OpenAS2ServerTest.java @@ -2,7 +2,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.PrefixFileFilter; -import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/WebUI/README.md b/WebUI/README.md index 9afcde38..f2fc8f03 100644 --- a/WebUI/README.md +++ b/WebUI/README.md @@ -29,6 +29,11 @@ The OpenAS2 public REST api Endpoint needs to be configured with the VUE_APP_RES ``` VUE_APP_RESTAPI_URL=https://openas2/rest/api ``` +### OpenAS2 Configuration + 1. Enable the REST command processor config/config.xml: + restapi.command.processor.enabled="true" + 1. Set the listening port for the command procesor to something usable on your server if the feault is not usable in config/config.xml: + restapi.command.processor.baseuri="http://0.0.0.0:8080" ### Compiles and hot-reloads for development ``` diff --git a/changes.txt b/changes.txt index be7eb366..dfde7ac1 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,14 @@ +Version 3.12.0 - 2024-10-15 +This is an minor enhancement release: + **IMPORTANT NOTE**: Please review upgrade notes in the RELEASE-NOTES.md if you are upgrading +1. Switch to Jakarta package for mail and REST implementations +2. Remove r3edundant packages from maven build +3. + Version 3.11.0 - 2024-08-22 This is an minor enhancement release: **IMPORTANT NOTE**: Please review upgrade notes in the RELEASE-NOTES.md if you are upgrading -1. Enhance the handling of MDN processing and asociated resend handling to provide moer reliable error handling. +1. Enhance the handling of MDN processing and asociated resend handling to provide more reliable error handling. 2. Enhance the Disposition-Notification-Options handler to properly support the standard. 3. Use the LTS releases of Java for testing 4. Use a SQL-92 compliant SQL format for accessing the database. diff --git a/pom.xml b/pom.xml index bd80e5ee..f054bba7 100644 --- a/pom.xml +++ b/pom.xml @@ -111,12 +111,6 @@ httpclient 4.5.14 - - com.google.code.findbugs - findbugs - 3.0.1 - provided - org.junit.jupiter junit-jupiter @@ -150,17 +144,15 @@ commons-io 2.16.1 - - javax.ws.rs - javax.ws.rs-api - 2.1.1 + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 - - javax.annotation - javax.annotation-api - 1.3.2 + jakarta.annotation + jakarta.annotation-api + 2.1.1 org.glassfish.jersey.containers