spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.57k stars 40.55k forks source link

Opsgenie alerts are not being sent after updating the Spring Boot version to 3.2.5. #41575

Closed pSinghDelaplex closed 2 months ago

pSinghDelaplex commented 2 months ago

Previously Our service is implemented on spring boot 2.7.1 and we are able to send alerts to opsgenie when services are UP/DOWN. Now, we migrated our service it to version 3.2.5 and alerts are not being sent after updating the version.

build.gradle

plugins {
id "org.springframework.boot" version "3.2.5"
id "io.spring.dependency-management" version "1.1.4"
id "java"
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "2.1.0"
id "com.jfrog.artifactory" version "5.2.0"
id 'org.gradle.maven-publish'
id "org.sonarqube" version "4.4.1.3373"

// only updated dependencies
dependency{
    implementation 'org.springframework:spring-web:6.1.6'
    implementation "org.springframework.integration:spring-integration-ip:6.2.2"
    implementation 'org.springframework:spring-beans:6.1.6'
    implementation 'org.springframework:spring-expression:6.1.6'
    implementation "org.modelmapper:modelmapper:3.2.0"
    implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0"
    implementation "com.github.ulisesbocchio:jasypt-spring-boot:3.0.5"
    implementation "com.opsgenie.integration:sdk:2+"
    implementation "org.springframework.boot:spring-boot-starter-jersey"
}

ext {
    set("springCloudVersion", "2023.0.1")
    set("springBootAdminVersion", "3.2.2")
}

application.yml

spring:
  application:
    name: sample-service
server:
  address: 0.0.0.0
  port: 8080
management:
  endpoints.web.exposure.include: "*"
  endpoint.health.show-details: always
logging:
  config: classpath:log4j2-spring.yml
  file.name: sample-service.log
ops-genie:
  apiKey: ********-****-****-****-************
  team: Test 
  notification:
    waiting-interval-time-in-minutes: 5
    on: true
TENANT_NAME: DEV-sample

I have used alerts implementation based on opsgenie docs https://docs.opsgenie.com/docs/opsgenie-java-api and its working fine with Spring Boot 2.7.1 but not with Spring boot 3.2.5 version.

Error while sending alert with upgraded spring boot version

Exception: java.lang.LinkageError: ClassCastException: attempting to castjar:file:/xyz/javax.ws.rs-api-2.0.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class to /xyz/javax.ws.rs-api-2.0.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class

wilkinsona commented 2 months ago

Spring Boot 3.x requires Jakarta EE 9 or later but javax.ws.rs.ext.RuntimeDelegate is from Jakarta EE 8 or earlier. I know essentially nothing about OpsGenie and its Java SDK, but, I assume that it uses JAX-RS somehow and that you'll need to upgrade to a Jakarta EE 9 compatible version of it.