简体   繁体   中英

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

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

将所需的JAR放入WebContent\\WEB-INF\\lib文件夹中。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM