'javax.ws.rs.core.Response injection problem during deploy on Payara

I'm here for a short answer - I don't hide it -, trying to make working my rest api. I copied a code template and the environment is the same: Payara5. My class:

import javax.ws.rs.core.Response;
import service.WaterParametersService;

@Path("")
@Stateless
public class WaterParametersRestImpl {

    @EJB
    private WaterParametersService wService;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("/waters")
    public Response getActualWaterInfo(
            @QueryParam("gps") Double[] gps,
            @QueryParam("water") String water
    ) {
        Meter result = wService.findByNameAndGps(water, gps);
        Gson gson = new Gson();
        String resultString = gson.toJson(result);
        return Response.ok().entity(resultString).build();
    }

At deploy I have the following error:

[2022-05-04T21:15:37.253+0200] [Payara 5.2020] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=990306 _ThreadName=admin-thread-pool::admin-listener(595)] [timeMillis: 1651691737253] [levelValue: 1000] [[ Exception during lifecycle processing java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] No injection source found for a parameter of type public javax.ws.rs.core.Response hu.vp.efogasinaplo.rest.WaterParametersRestImpl.getActualWaterInfo(java.lang.Double[],java.lang.String) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[], producedTypes=[text/plain], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class hu.vp.efogasinaplo.rest.WaterParametersRestImpl, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@e710995]}, definitionMethod=public javax.ws.rs.core.Response hu.vp.efogasinaplo.rest.WaterParametersRestImpl.getActualWaterInfo(java.lang.Double[],java.lang.String), parameters=[Parameter [type=class [Ljava.lang.Double;, source=gps, defaultValue=null], Parameter [type=class java.lang.String, source=water, defaultValue=null]], responseType=class javax.ws.rs.core.Response}, nameBindings=[]}'] at com.sun.enterprise.web.WebApplication.start(WebApplication.java:137) ... ... ...

The related dependency in pom.xml:

<dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source