先贴一段日志信息:
2016-08-16 10:54:19,104 [http-apr-8080-exec-4] [fb5b5f9e-4724-425f-aa14-fb2317da19e6] [X-UID-] INFO com.sudaotech.core.web.filter.ExceptionLoggingFilter - > POST /platform/hejia/hjComment/ 2016-08-16 10:54:19,168 [http-apr-8080-exec-4] [fb5b5f9e-4724-425f-aa14-fb2317da19e6] [X-UID-7662596-5DogEFKj] DEBUG org.jboss.resteasy.core.SynchronousDispatcher - PathInfo: /hejia/hjComment 2016-08-16 10:54:19,168 [http-apr-8080-exec-4] [fb5b5f9e-4724-425f-aa14-fb2317da19e6] [X-UID-7662596-5DogEFKj] ERROR com.sudaotech.core.web.resteasy.NotFoundExceptionHandler - Could not find resource for full path: http://localhost:8080/platform/hejia/hjComment/ 2016-08-16 10:54:19,277 [http-apr-8080-exec-4] [fb5b5f9e-4724-425f-aa14-fb2317da19e6] [X-UID-7662596-5DogEFKj] DEBUG com.sudaotech.core.web.resteasy.RestEasyContainerFilter - < Response, time-taken: 1471316059277 {"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); }