在Payara 4上部署泽西网络服务不会暴露方法 [英] Deploying jersey web services on Payara 4 doesn´t expose methods

查看:172
本文介绍了在Payara 4上部署泽西网络服务不会暴露方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Maven Web项目,通过Payara 4公开一些球衣网络服务,该项目构建良好,但我的网络方法没有公开。

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.

这是主要类:

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?

提前致谢!

推荐答案

您是否为JAX-RS资源定义了一个应用程序?如果你把它放在与资源相同的文件夹中,这就足够了:

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 {

}

您的网络服务将在 API_PATH_FOR_JAXRS / test

这篇关于在Payara 4上部署泽西网络服务不会暴露方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆