com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException

断了今生、忘了曾经 提交于 2019-12-13 04:29:34

问题


Hi I am getting below exception in my web service REST. I understand that MappableContainerException is just a wrapper exception that Jersey uses if the underlying code threw something that is not mappable to a response (in my case it is the NoClassDefFoundError). But I don't khow how to fix it.

com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
GRAVE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoClassDefFoundError: com/rest/util/Model

The Model class exist in an other maven project "REST-Util" and I integrated it my pom.xml tlike this :

    <dependency>
        <groupId>com.rest.util</groupId>
        <artifactId>REST-Util</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>

I would greatly appreciate it if you can help me solve this problem. Thanks in advance


回答1:


Put your required JAR inside WebContent\WEB-INF\lib folder.




回答2:


The most likely answer is that a dependency contract has changed or is different from what you are expecting(perhaps a version issue). Likely an interface method named changed, but it's not limited to that, it could also be a class name change or some other interface facet too.

I ran into this same error when renaming a method of a library I wrote where it seemed that the cached version differed from the file version and Jersey failed to pick up the name change and kept referring to the old name. I cleaned the project and everything was good after that.

ALSO, make sure that you are exporting your dependency in the Java build path. That's likely cause of the java.lang.NoClassDefFoundError: com/rest/util/Model error



来源:https://stackoverflow.com/questions/16968675/com-sun-jersey-spi-container-containerresponse-mapmappablecontainerexception

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