RESTEasy - javax.ws.rs.NotFoundException: Could not find resource for full path

我的梦境 提交于 2019-12-05 13:10:53

You added your resource using a method named getMatches(), which Resteasy knows nothing about. You need to override the getSingletons() method of Application and return your root resources from there as shown below.

Documentation Here

Example:

public class MatchApplication extends Application {
    private Set<Object> singletons = new HashSet<Object>();
    private Set<Class<?>> classes = new HashSet<Class<?>>();

    public MatchApplication() {
        singletons.add(new MatchServiceImpl());
    }

    @Override
    public Set<Class<?>> getClasses() {
        return classes;
    }

    @Override
    public Set<Object> getSingletons() {
        return singletons;
    }
}

First, I think your MatchApplication class should be annotated with @ApplicationPath("/api"). I'm sorry if that's already done.

Then, depending on your RESTEasy version, it will scan automatically for classes that are providers or resources, so you don't need to give to implement anything on your MatchApplication for now. Just extend Application and you are done.

If you can update your web-app to use servlet 3.0, you don't need to put any kind of configuration into your web.xml.

Read more on the RESTEasy documentation.

This works for all my services.

This is a runtime exception indicating a resource requested by a client was not found on the server.
Add below entry into your web.xml :

<context-param>
        <param-name>resteasy.resources</param-name>
        <param-value>com.org.abc.xyz.MainClassName</param-value>
</context-param>

You can specify fully qualified name of your JAX-RS resource class name you want to register. If you have multiple classes entries, use comma delimiter.

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