天天看點

RESTEASY報錯Could not find resource for full path

先貼一段日志資訊:

-- ::, [http-apr--exec-] [fb5b5f9e--f-aa14-fb2317da19e6] [X-UID-] INFO  com.sudaotech.core.web.filter.ExceptionLoggingFilter - > POST /platform/hejia/hjComment/
-- ::, [http-apr--exec-] [fb5b5f9e--f-aa14-fb2317da19e6] [X-UID--DogEFKj] DEBUG org.jboss.resteasy.core.SynchronousDispatcher - PathInfo: /hejia/hjComment
-- ::, [http-apr--exec-] [fb5b5f9e--f-aa14-fb2317da19e6] [X-UID--DogEFKj] ERROR com.sudaotech.core.web.resteasy.NotFoundExceptionHandler - Could not find resource for full path: http://localhost:/platform/hejia/hjComment/
-- ::, [http-apr--exec-] [fb5b5f9e--f-aa14-fb2317da19e6] [X-UID--DogEFKj] DEBUG com.sudaotech.core.web.resteasy.RestEasyContainerFilter - < Response, time-taken: 
{"code":"404","message":"Not Found","data":null,"location":null}
           

做項目時碰到這個問題,還是由于粗心的緣故,在寫完Resource和service之後沒有進行注入,進而調用接口的時候會提示找不到,沒有初始化的緣故,我這邊用的是Mybatis+Guice,是以在子產品代碼中進行注入即可。

private void HjCommentModule() {
        addMapperClass(HjCommentEntityMapper.class);
        bind(HjCommentService.class).to(HjCommentServiceImpl.class).in(Scopes.SINGLETON);
        bind(HjCommentResource.class);
        bind(CommentResource.class);
    }
           

繼續閱讀