Deploying jersey web services on Payara 4 doesn´t expose methods

断了今生、忘了曾经 提交于 2019-12-08 03:54:41

问题


I developed a Maven Web Project to expose some jersey web services through Payara 4, the project builds fine, but my web methods are not exposed.

Here is the main class:

package br.com.ainstec.cfrjob.api.resources;

import br.com.concil.cfrimporter.controller.CfrImport;
import br.com.concil.cfrimporter.model.PojoTest;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Recurso REST para tratar chamadas
 *
 */
@Path("test")
//@RequestScoped
public class TestResource {

    private static final Logger logger = LoggerFactory.getLogger(TestResource.class);

    @GET
    @Path("run")
    @Consumes(MediaType.TEXT_PLAIN)
    public void run(PojoTest pojoBody) {
        logger.info("Starting Camel Job Test#1");

What could be the problem? The service needs to be registered somewhere?

Thanks in advance!


回答1:


Do you have defined an Application for your JAX-RS resources? If you put it in the same folder as your resources this should be sufficient:

@javax.ws.rs.ApplicationPath("API_PATH_FOR_JAXRS")
public class SampleApplication extends Application {

}

Your web service will then be availble under API_PATH_FOR_JAXRS/test



来源:https://stackoverflow.com/questions/33025458/deploying-jersey-web-services-on-payara-4-doesn%c2%b4t-expose-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!