我将 Jersey 资源类捆绑在一个更大的 WAR 形式的 JAR 文件中,该文件现在位于 Websphere Application Server 上的 WEB-INF/lib 文件夹下。我有正确的 web.xml 条目(WEB-INF/web.xml),但仍在服务器上,扫描似乎无法查找捆绑为 JAR 的资源类。我正在查看一些线程,建议不要将资源捆绑为 JAR,而是在/WEB-INF/classes 下单独加载类。
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>blah.blah.blah</param-value>
</init-param>
</servlet>
<小时/>com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes..at com.sun.jersey.server.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:1064)
最佳答案
Rohit 的博客文章中概述了有关特定版本的 WebSphere 的各种 Jersey 问题的问题,您能看看那里有什么可以帮助您吗?
http://wasdynacache.blogspot.com/2011/08/jax-rs-implementations-in-websphere.html
关于java - Jersey 资源 .class 加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10606919/