RestEasy接口和实现

时间:2014-03-18 13:50:39

标签: java jboss resteasy

一切都没有改变代码就开始了。这是jboss配置中的问题

我有这样的界面

@Path("/send")
public interface Sender {

    @POST
    @Path("sms")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @FibianMethod(value = MethodAccess.ANY)
    FibResult sendBasketIdBySMS(@WebParam(name = "data") SendData data)
        throws FailureException;
}

我需要创建一个这个接口的实现。

@Stateless
@Named("sender")
public class SenderBean implements Sender {

    @Inject
    private MessageTemplateConnector manager;

    @Inject
    private BasketDao dao;

//    @Inject
//    private DbTemplateLookup templateLookup;

    @Inject
    private MessageBuilder messageBuilder;

    @Inject
    private RequestContext context;

    @Inject
    private BasketDao basketDao;

    @Override
    public FibResult sendBasketIdBySMS(SendData data) throws FailureException {
        PayBasket payBasket = dao.findBasket(data.getBasketId());
        if (payBasket.getStatus() != BasketStatus.PREPARED) {
            throw new FailureException(PayBasketError.UNKNOWN_BASKET);
        }

        Counts counts = basketDao.getCounts(payBasket, null, data.getPaySystemId());

        HashMap<String, String> parameters = new HashMap<>(2);

        parameters.put("BASKET_CODE", data.getBasketId().toString());
        Double sum = counts.getTotalSumToPay() / 100d;

        parameters.put("SUM_TO_PAY", String.format("%8.2f", sum));

        InputMessage message = messageBuilder.getInputMessage("BASKET_NUMBER", context.getLangId(), parameters);
        message.setDestination(data.getPhoneNumber());
        message.setRecipient(data.getPhoneNumber());
        manager.sendMessage("SHIFTPAY", message);

        return new FibResult(Const.OK);
    }

}

当我在JBOSS 7上部署时出现错误:

java.lang.NoSuchMethodError:
    org.jboss.resteasy.util.GetRestful.getSubResourceClass(Ljava/lang/Class;)

如果rest接口的实现和映射在一个类中,那么一切都很顺利。

0 个答案:

没有答案