I try to use jersey 3 with glassfish 7 (EE10).
Specifically I am looking for a "working" sample project.
I guess I have an issue with the right dependencies:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.allopen' version '1.8.22'
id 'war'
}
group 'com.vanwaasen.mbp'
version '1.0-SNAPSHOT'
war {
archiveFileName = "mbp.war"
}
repositories {
mavenCentral()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
allOpen {
annotation('jakarta.ws.rs.Path')
}
dependencies {
compileOnly('jakarta.servlet:jakarta.servlet-api:6.0.0')
compileOnly('jakarta.websocket:jakarta.websocket-api:2.1.1')
compileOnly('jakarta.ws.rs:jakarta.ws.rs-api:3.1.0')
compileOnly('org.glassfish.jersey.containers:jersey-container-servlet:3.1.4')
compileOnly('org.glassfish.jersey.core:jersey-client:3.1.4')
implementation('com.fasterxml.jackson.module:jackson-module-kotlin:2.16.0')
implementation('org.jsoup:jsoup:1.15.3')
}
My specific problem is that the APIs with PathParam return 404:
WORKING
@GET
@Path("/ping")
@Produces("text/plain")
fun hello(): String {
return "ping"
}
NOT WORKING
@GET
@Path("/import/{origin}")
@Produces("text/plain")
fun import(@PathParam("origin") origin : String): Response {
return Response.ok().entity("import $origin").build()
}
NO exceptions in server.log.
Additionaly I am using ResourceConfig:
@ApplicationPath("/api")
class MBPApplication : ResourceConfig() {
init {
packages("com.vanwaasen.mbp")
}
}
Any advice (correct dependencies) or hint to a working example application (glassfish 7.0.11 & JERSEY 3) is appreciated.
Best Regards
Jochen
[Updated on: Wed, 17 January 2024 13:22] by Moderator