404 on JAX-RS on Tomcat, MBeans?

巧了我就是萌 提交于 2021-01-29 18:11:59

问题


I'm getting a 404 on a JAX-RS request, but am running out of things to try out of my bag of tricks.

Simplified code where service is defined:

package mypackage;

@Path("/")
public class SavedQueriesService {
...
    @POST
    @Path("saved_queries")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces({ MediaType.APPLICATION_JSON + AppConstants.COMMA + MediaType.CHARSET_PARAMETER + AppConstants.UTF_8 })
    public Response saveNewSavedQuery(@Context HttpServletRequest httpServletRequest, 
            SavedQueryRequest savedQueryRequest, @QueryParam("saved_query_context_name") String savedQueryContextName,
            @QueryParam("saved_query_context_id") Integer savedQueryContextId) {
    ...
    }
}
@ApplicationPath("/report")
class SavedQueriesServiceConfig extends ResourceConfig {
    public SavedQueriesServiceConfig() {
        register(JacksonFeatures.class);
        register(CORSResponseFilter.class);
        register(JsonParseExceptionMapper.class);
        packages("mypackage");
    }
}

URL Request:

URL request:
POST localhost:8090/ROOT/report/saved_queries
Accept-Encoding: application/json
Content-Type: application/json

So I made sure to specify the correct mime type (though I think an incorrect one would generate a 415, not a 404) and I also made sure the HTTP verb is correct.

If only I could get Tomcat to list out somewhere what URI's it actually knows about. Is it possible to get this from an MBean somewhere?

来源:https://stackoverflow.com/questions/64421903/404-on-jax-rs-on-tomcat-mbeans

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