Problem generating the <grammars> of the WADL file with jakarta.ws.rs

Hello to all

I meet a problem on Payara (tested on version 5.2022.2 and 5.2022.4) when migrating my WS from java 11 to java 17. Previously, I was using javax.ws.rs to describe my WS (on version 5.2022.2). I switched to jakarta.ws.rs to be up to date in my dependencies for java 17. And that’s where the problem comes in: with jakarta.ws.rs, I no longer have generation of the <grammars> in the WADL file, which makes WS unusable (they are well deployed)

I don’t know what the error could be and I would need the advice of a java and REST specialist. I’m not up to date enough on this side.

Below are my anonymized pom.xml, web.xml, payara-web.xml and a very simple example of webservice method

Thanks a lot for your help
Thierry


pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>fr.inrae.sicpa</groupId>
  <artifactId>MyServiceRest</artifactId>
  <version>1.2.3</version>
  <packaging>war</packaging>
  <name>MyServiceRest</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>

  <dependencies>
    <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.10</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
    <dependency>
      <groupId>com.mysql</groupId>
      <artifactId>mysql-connector-j</artifactId>
      <version>8.0.31</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.15</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-api</artifactId>
      <version>0.11.5</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl -->
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-impl</artifactId>
      <version>0.11.5</version>
      <scope>runtime</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson -->
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-jackson</artifactId>
      <version>0.11.5</version>
      <scope>runtime</scope>
    </dependency>    
    <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>3.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <version>4.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-common -->
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-common</artifactId>
      <version>2.34</version>
    </dependency>
  </dependencies>

  <build>
    <finalName>MyServiceRest</finalName>
    <directory>${basedir}/target</directory>
    <!-- main -->
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
    <outputDirectory>${basedir}/target/classes</outputDirectory>
    <!-- test -->
    <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
    <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
    <extensions>
      <!-- https://mvnrepository.com/artifact/org.apache.maven.wagon/wagon-ssh -->
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>3.5.2</version>
      </extension>
    </extensions>
    <plugins>
	  <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>enforce-profile-target</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireActiveProfile>
                  <profiles>prod,rec,test</profiles>
                  <all>false</all>
                </requireActiveProfile>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-war-plugin -->
	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-war-plugin</artifactId>
	    <version>3.3.2</version>
	    <configuration>
          <failOnMissingWebXml>true</failOnMissingWebXml>
	      <warSourceDirectory>${basedir}/src/main/webapp/WebContent</warSourceDirectory>
	      <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
	    </configuration>
	  </plugin>  
      <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/wagon-maven-plugin -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <version>2.0.2</version>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>*.properties</include>
        </includes>
      </resource>
    </resources>
  </build>

  <profiles>
    <profile>
      <id>rec</id>
      <activation>
        <property>
          <name>env</name>
          <value>rec</value>
        </property>
      </activation>
      <build>
        <finalName>MyServiceRest-rec</finalName>
        <plugins>
          <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/wagon-maven-plugin -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>2.0.2</version>
            <executions>
              <execution>
                <id>primary-rec</id>
                <phase>deploy</phase>
                <goals>
                  <goal>upload-single</goal>
                </goals>
                <configuration>
                  <fromFile>${project.build.directory}/${project.build.finalName}.${project.packaging}</fromFile>
                  <url>scp://bob@primary.server.fr:/data/apps/payara/autodeploy</url>
                </configuration>
              </execution>
              <execution>
                <id>secondary-rec</id>
                <phase>deploy</phase>
                <goals>
                  <goal>upload-single</goal>
                </goals>
                <configuration>
                  <fromFile>${project.build.directory}/${project.build.finalName}.${project.packaging}</fromFile>
                  <url>scp://bob@secondary.server.fr:/data/apps/payara/autodeploy</url>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
        <resources>
          <resource>
            <directory>${basedir}/src/main/resources/rec</directory>
            <filtering>true</filtering>
            <includes>
              <include>*.properties</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>
    <profile>
      <id>prod</id>
      <activation>
        <property>
          <name>env</name>
          <value>prod</value>
        </property>
      </activation>
      <build>
        <finalName>MyServiceRest</finalName>
        <plugins>
          <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>enforce-prod-no-snapshot</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseVersion/>
                    <requireReleaseDeps/>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/wagon-maven-plugin -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>2.0.2</version>
            <executions>
              <execution>
                <id>primary-prod</id>
                <phase>deploy</phase>
                <goals>
                  <goal>upload-single</goal>
                </goals>
                <configuration>
                  <fromFile>${project.build.directory}/${project.build.finalName}.${project.packaging}</fromFile>
                  <url>scp://bob@primary.server.fr:/data/apps/payara/autodeploy</url>
                </configuration>
              </execution>
              <execution>
                <id>secondary-prod</id>
                <phase>deploy</phase>
                <goals>
                  <goal>upload-single</goal>
                </goals>
                <configuration>
                  <fromFile>${project.build.directory}/${project.build.finalName}.${project.packaging}</fromFile>
                  <url>scp://bob@secondary.server.fr:/data/apps/payara/autodeploy</url>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
        <resources>
          <resource>
            <directory>${basedir}/src/main/resources/prod</directory>
            <filtering>true</filtering>
            <includes>
              <include>*.properties</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>
    <profile>
      <id>test</id>
      <activation>
        <property>
          <name>env</name>
          <value>test</value>
        </property>
      </activation>
      <build>
        <finalName>MyServiceRest-test</finalName>
        <resources>
          <resource>
            <directory>${basedir}/src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
              <include>*.properties</include>
            </includes>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <warName>${project.name}</warName>
              <outputDirectory>C:\Java\servers\payara5\glassfish\domains\domain1\autodeploy</outputDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
  <display-name>MyServiceRest</display-name>
  <servlet>
    <display-name>Rest Servlet</display-name>
    <servlet-name>RestServlet</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>fr.company.unit</param-value>
    </init-param>
    <init-param>
      <param-name>jersey.config.server.provider.classnames</param-name>
      <param-value>org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>RestServlet</servlet-name>
    <url-pattern>/api/*</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

payara-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE payara-web-app PUBLIC "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN" "https://raw.githubusercontent.com/payara/Payara-Server-Documentation/master/schemas/payara-web-app_4.dtd">
<payara-web-app>
    <context-root>/MyServiceRest</context-root>
</payara-web-app>

ApiService.java

package fr.company.unit.services;

import com.google.gson.Gson;
import fr.company.unit.helper.ConfigBD;
import fr.company.unit.services.interfaces.IApiService;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

@Path("")
public class ApiService implements IApiService
{
    ConfigBD config = new ConfigBD();

   /**
     * Returns the version of the web service
     * @return a string containing the webservice version
     */    @GET
    @Path("version")
    public String getVersion()
    {
        return new Gson().toJson(config.getValue("version"));
    }
}