java com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16968675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
提问by Wijden
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.
嗨,我的 Web 服务 REST 出现异常。我知道 MappableContainerException 只是 Jersey 使用的一个包装器异常,如果底层代码抛出了一些不可映射到响应的东西(在我的例子中是 NoClassDefFoundError)。但我不知道如何修复它。
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 :
Model 类存在于另一个 maven 项目“REST-Util”中,我将它集成到我的 pom.xml 中,如下所示:
<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
如果您能帮我解决这个问题,我将不胜感激。提前致谢
回答by Somnath Kadam
Put your required JAR inside WebContent\WEB-INF\lib
folder.
将所需的 JAR 放入WebContent\WEB-INF\lib
文件夹中。
回答by Roy Hinkley
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.
在重命名我编写的库的方法时,我遇到了同样的错误,其中缓存版本似乎与文件版本不同,并且 Jersey 未能获取名称更改并继续引用旧名称。我清理了项目,之后一切都很好。
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
另外,请确保您在 Java 构建路径中导出您的依赖项。这可能是java.lang.NoClassDefFoundError: com/rest/util/Model
错误的原因