Skip to main content



      Home
Home » Eclipse Projects » GlassFish » glassfish 7 (EE10) & jersey 3
glassfish 7 (EE10) & jersey 3 [message #1863126] Wed, 17 January 2024 06:50
Eclipse UserFriend
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

Previous Topic:Package or class (SetPropertyActionListenerImpl) not found in GF7
Next Topic:randomly glassfish crash
Goto Forum:
  


Current Time: Tue Apr 29 20:56:11 EDT 2025

Powered by FUDForum. Page generated in 0.03831 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top