这是我的例外
com.sun.jersey.api.container.ContainerException:ResourceConfig实例不包含任何根资源类。
根据其他问题,我必须设置此属性
com.sun.jersey.api.core.PackagesResourceConfig
我确实做了,如你所见:
<servlet>
<servlet-name>MMS-Client</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>mypackage.servlets</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MMS-Client</servlet-name>
<url-pattern>/mmsclient/*</url-pattern>
</servlet-mapping>
包裹在那里,为什么我有这个错误?
这是我班上的签名
@Path("om" + "/mms")
public class class1 extends Class2 {
@GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
public String test() {
return "test";
}
这就是pom
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.18</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.18</version>
</dependency>