From a4b518b2476cd6c00910130ca8a9473756857531 Mon Sep 17 00:00:00 2001 From: Matt Magoffin Date: Fri, 22 Dec 2023 17:45:45 +1300 Subject: [PATCH 1/5] Tweak to fix "already closed" exception in unit tests by removing prepared statement cache. --- .../src/main/resources/application.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/solarnet/solarflux-vernemq-webhook/src/main/resources/application.yml b/solarnet/solarflux-vernemq-webhook/src/main/resources/application.yml index 706668688..698656f16 100644 --- a/solarnet/solarflux-vernemq-webhook/src/main/resources/application.yml +++ b/solarnet/solarflux-vernemq-webhook/src/main/resources/application.yml @@ -28,7 +28,6 @@ spring: validationInterval: 35000 removeAbandoned: true removeAbandonedTimeout: 600 - jdbcInterceptors: "ConnectionState;StatementCache(prepared=true,callable=false,max=50);ResetAbandonedTimer" jackson: default-property-inclusion: non_null @@ -38,6 +37,7 @@ logging: file: "%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:%5p} %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}" level: net.solarnetwork: DEBUG + org.apache.tomcat: TRACE debugMode: true @@ -48,6 +48,8 @@ spring: url: jdbc:postgresql://localhost:5412/solarnetwork username: solarauth password: solarauth + tomcat: + jdbcInterceptors: "ConnectionState;StatementCache(prepared=true,callable=false,max=50);ResetAbandonedTimer" debugMode: true @@ -58,6 +60,9 @@ logging: --- spring: config.activate.on-profile: production + datasource: + tomcat: + jdbcInterceptors: "ConnectionState;StatementCache(prepared=true,callable=false,max=50);ResetAbandonedTimer" debugMode: false From ddd47d5c3881828f75919e56d4d69f0fe9fcbf5c Mon Sep 17 00:00:00 2001 From: Matt Magoffin Date: Fri, 22 Dec 2023 17:46:22 +1300 Subject: [PATCH 2/5] Update to Spring Boot 3.2.1. --- solarnet/common-test/build.gradle | 2 +- solarnet/common/build.gradle | 2 +- solarnet/datum/build.gradle | 2 +- solarnet/dnp3/build.gradle | 2 +- solarnet/instructor/build.gradle | 2 +- solarnet/net-proxy/build.gradle | 2 +- solarnet/ocpp/build.gradle | 2 +- solarnet/oscp-fp/build.gradle | 2 +- solarnet/oscp-sim-cp/build.gradle | 2 +- solarnet/oscp/build.gradle | 2 +- solarnet/solardnp3/build.gradle | 2 +- solarnet/solarflux-vernemq-webhook/build.gradle | 2 +- solarnet/solarin/build.gradle | 2 +- solarnet/solarjobs/build.gradle | 2 +- solarnet/solarocpp/build.gradle | 2 +- solarnet/solarquery/build.gradle | 2 +- solarnet/solaruser/build.gradle | 2 +- solarnet/user-billing/build.gradle | 2 +- solarnet/user-datum/build.gradle | 2 +- solarnet/user-dnp3/build.gradle | 2 +- solarnet/user-ocpp/build.gradle | 2 +- solarnet/user-oscp/build.gradle | 2 +- solarnet/user/build.gradle | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/solarnet/common-test/build.gradle b/solarnet/common-test/build.gradle index 0bbdc7dc8..a48b19ddf 100644 --- a/solarnet/common-test/build.gradle +++ b/solarnet/common-test/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/common/build.gradle b/solarnet/common/build.gradle index d70f548cb..9cccc05bf 100644 --- a/solarnet/common/build.gradle +++ b/solarnet/common/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/datum/build.gradle b/solarnet/datum/build.gradle index 9c20ae660..69902d6ba 100644 --- a/solarnet/datum/build.gradle +++ b/solarnet/datum/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/dnp3/build.gradle b/solarnet/dnp3/build.gradle index 69331139d..a44a429d3 100644 --- a/solarnet/dnp3/build.gradle +++ b/solarnet/dnp3/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/instructor/build.gradle b/solarnet/instructor/build.gradle index 00be36595..b99f3c534 100644 --- a/solarnet/instructor/build.gradle +++ b/solarnet/instructor/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/net-proxy/build.gradle b/solarnet/net-proxy/build.gradle index 9e9f43f65..149a4130a 100644 --- a/solarnet/net-proxy/build.gradle +++ b/solarnet/net-proxy/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/ocpp/build.gradle b/solarnet/ocpp/build.gradle index fab2d22e3..a2c96118d 100644 --- a/solarnet/ocpp/build.gradle +++ b/solarnet/ocpp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/oscp-fp/build.gradle b/solarnet/oscp-fp/build.gradle index 751d438d0..46193e689 100644 --- a/solarnet/oscp-fp/build.gradle +++ b/solarnet/oscp-fp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/oscp-sim-cp/build.gradle b/solarnet/oscp-sim-cp/build.gradle index 3995fc6bd..f32585e23 100644 --- a/solarnet/oscp-sim-cp/build.gradle +++ b/solarnet/oscp-sim-cp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/oscp/build.gradle b/solarnet/oscp/build.gradle index b7f52e8d9..da4c14ce5 100644 --- a/solarnet/oscp/build.gradle +++ b/solarnet/oscp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/solardnp3/build.gradle b/solarnet/solardnp3/build.gradle index 4a5660cb3..f7e3fdc70 100644 --- a/solarnet/solardnp3/build.gradle +++ b/solarnet/solardnp3/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solarflux-vernemq-webhook/build.gradle b/solarnet/solarflux-vernemq-webhook/build.gradle index 1971c597f..47ac45c12 100644 --- a/solarnet/solarflux-vernemq-webhook/build.gradle +++ b/solarnet/solarflux-vernemq-webhook/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solarin/build.gradle b/solarnet/solarin/build.gradle index eeaff59f4..6056099a7 100644 --- a/solarnet/solarin/build.gradle +++ b/solarnet/solarin/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solarjobs/build.gradle b/solarnet/solarjobs/build.gradle index 6221f579f..508a62491 100644 --- a/solarnet/solarjobs/build.gradle +++ b/solarnet/solarjobs/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solarocpp/build.gradle b/solarnet/solarocpp/build.gradle index 9552fe830..45982d973 100644 --- a/solarnet/solarocpp/build.gradle +++ b/solarnet/solarocpp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solarquery/build.gradle b/solarnet/solarquery/build.gradle index 0812ed4b4..c89e7c1c6 100644 --- a/solarnet/solarquery/build.gradle +++ b/solarnet/solarquery/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } apply plugin: 'java' diff --git a/solarnet/solaruser/build.gradle b/solarnet/solaruser/build.gradle index 02a70336b..486c78096 100644 --- a/solarnet/solaruser/build.gradle +++ b/solarnet/solaruser/build.gradle @@ -2,7 +2,7 @@ plugins { //id 'checkstyle' id 'java' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' + id 'org.springframework.boot' version '3.2.1' } //apply plugin: 'checkstyle' diff --git a/solarnet/user-billing/build.gradle b/solarnet/user-billing/build.gradle index 6d5a9aa9b..0226302bd 100644 --- a/solarnet/user-billing/build.gradle +++ b/solarnet/user-billing/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/user-datum/build.gradle b/solarnet/user-datum/build.gradle index 556e60599..96a6cdb87 100644 --- a/solarnet/user-datum/build.gradle +++ b/solarnet/user-datum/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/user-dnp3/build.gradle b/solarnet/user-dnp3/build.gradle index 1a03566eb..b6d74957a 100644 --- a/solarnet/user-dnp3/build.gradle +++ b/solarnet/user-dnp3/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/user-ocpp/build.gradle b/solarnet/user-ocpp/build.gradle index 7628d428c..3ed0fcab4 100644 --- a/solarnet/user-ocpp/build.gradle +++ b/solarnet/user-ocpp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/user-oscp/build.gradle b/solarnet/user-oscp/build.gradle index 0b96aa25d..9ce3e6581 100644 --- a/solarnet/user-oscp/build.gradle +++ b/solarnet/user-oscp/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' diff --git a/solarnet/user/build.gradle b/solarnet/user/build.gradle index ba08317ee..c56229951 100644 --- a/solarnet/user/build.gradle +++ b/solarnet/user/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id 'eclipse' - id 'org.springframework.boot' version '3.2.0' apply false + id 'org.springframework.boot' version '3.2.1' apply false } apply plugin: 'java-library' From d2369025d1bb8c54cd18e1de9a89c612fcc0f031 Mon Sep 17 00:00:00 2001 From: Matt Magoffin Date: Sat, 13 Jan 2024 11:17:23 +1300 Subject: [PATCH 3/5] Bump MQTT dep to pick up updates. --- solarnet/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarnet/build.gradle b/solarnet/build.gradle index 618557d95..46a4ba262 100644 --- a/solarnet/build.gradle +++ b/solarnet/build.gradle @@ -68,7 +68,7 @@ subprojects { jsonSchemaValidatorVersion = '1.0.73' myBatisStarterVersion = '3.0.3' snCommonVersion = '3.5.2' - snCommonMqttVersion = '4.0.0' + snCommonMqttVersion = '4.0.1' snCommonMqttNettyVersion = '3.0.1' snCommonOcppVersion = '2.7.0' snCommonOcpp16Version = '2.1.7' From 364aa8e462d228f68e93536c90d77cad7e9ef322 Mon Sep 17 00:00:00 2001 From: Matt Magoffin Date: Sat, 13 Jan 2024 11:39:51 +1300 Subject: [PATCH 4/5] Turn ERROR logs into WARN and add time threshold to avoid flooding logs when publishing aggregate data and SolarFlux connection is lost. --- .../datum/flux/SolarFluxDatumPublisher.java | 57 ++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/solarnet/datum/src/main/java/net/solarnetwork/central/datum/flux/SolarFluxDatumPublisher.java b/solarnet/datum/src/main/java/net/solarnetwork/central/datum/flux/SolarFluxDatumPublisher.java index f107b08aa..9ebc083b8 100644 --- a/solarnet/datum/src/main/java/net/solarnetwork/central/datum/flux/SolarFluxDatumPublisher.java +++ b/solarnet/datum/src/main/java/net/solarnetwork/central/datum/flux/SolarFluxDatumPublisher.java @@ -44,7 +44,7 @@ * Publish datum to SolarFlux. * * @author matt - * @version 2.1 + * @version 2.2 */ public class SolarFluxDatumPublisher extends MqttJsonPublisher> implements DatumProcessor { @@ -65,7 +65,13 @@ public class SolarFluxDatumPublisher extends MqttJsonPublisher 0 ) { + final long now = System.currentTimeMillis(); + final long tdiff = errorLogLimitMs > 0 ? now - lastErrorTime : lastErrorTime; + if ( tdiff >= lastErrorTime ) { + logPublishError(e, root, aggregation); + lastErrorTime = now; + } else { + log.debug("Problem publishing {} datum to SolarFlux: {}", + aggDisplayName(aggregation), root.getMessage()); + } } else { - log.error("Error publishing {} datum to SolarFlux: {}", aggDisplayName(aggregation), - root.toString(), e); + logPublishError(e, root, aggregation); } } return false; } + private void logPublishError(Throwable e, Throwable root, Aggregation aggregation) { + if ( (root instanceof RemoteServiceException) + || (root instanceof net.solarnetwork.service.RemoteServiceException) ) { + log.warn("Problem publishing {} datum to SolarFlux: {}", aggDisplayName(aggregation), + root.getMessage()); + } else { + log.error("Problem publishing {} datum to SolarFlux: {}", aggDisplayName(aggregation), + root.toString(), e); + } + } + private static String aggDisplayName(Aggregation aggregation) { return aggregation == Aggregation.None ? "Raw" : aggregation.toString(); } @@ -194,4 +216,25 @@ private String topicForDatum(Aggregation aggregation, Identity Date: Sat, 13 Jan 2024 11:44:40 +1300 Subject: [PATCH 5/5] Bump versions. --- solarnet/datum/build.gradle | 2 +- solarnet/oscp-fp/build.gradle | 2 +- solarnet/solardnp3/build.gradle | 2 +- solarnet/solarin/build.gradle | 2 +- solarnet/solarjobs/build.gradle | 2 +- solarnet/solarocpp/build.gradle | 2 +- solarnet/solaruser/build.gradle | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/solarnet/datum/build.gradle b/solarnet/datum/build.gradle index 69902d6ba..823b87117 100644 --- a/solarnet/datum/build.gradle +++ b/solarnet/datum/build.gradle @@ -14,7 +14,7 @@ dependencyManagement { } description = 'SolarNet: Datum' -version = '2.1.0' +version = '2.2.0' base { archivesName = 'solarnet-datum' diff --git a/solarnet/oscp-fp/build.gradle b/solarnet/oscp-fp/build.gradle index 46193e689..9ea75138f 100644 --- a/solarnet/oscp-fp/build.gradle +++ b/solarnet/oscp-fp/build.gradle @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarOSCP Flexibility Provider' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solaroscp-fp' diff --git a/solarnet/solardnp3/build.gradle b/solarnet/solardnp3/build.gradle index f7e3fdc70..8f3006240 100644 --- a/solarnet/solardnp3/build.gradle +++ b/solarnet/solardnp3/build.gradle @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarDNP3' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solardnp3' diff --git a/solarnet/solarin/build.gradle b/solarnet/solarin/build.gradle index 6056099a7..ee1b94339 100644 --- a/solarnet/solarin/build.gradle +++ b/solarnet/solarin/build.gradle @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarIn' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solarin' diff --git a/solarnet/solarjobs/build.gradle b/solarnet/solarjobs/build.gradle index 508a62491..fe68f9ffe 100644 --- a/solarnet/solarjobs/build.gradle +++ b/solarnet/solarjobs/build.gradle @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarJobs' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solarjobs' diff --git a/solarnet/solarocpp/build.gradle b/solarnet/solarocpp/build.gradle index 45982d973..cc26a1bf5 100644 --- a/solarnet/solarocpp/build.gradle +++ b/solarnet/solarocpp/build.gradle @@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarOCPP' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solarocpp' diff --git a/solarnet/solaruser/build.gradle b/solarnet/solaruser/build.gradle index 486c78096..abb808c87 100644 --- a/solarnet/solaruser/build.gradle +++ b/solarnet/solaruser/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' description = 'SolarUser' -version = '2.1.0' +version = '2.1.1' base { archivesName = 'solaruser'