Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 404带球衣测试_Java_Hibernate_Testing_Jersey - Fatal编程技术网

Java 404带球衣测试

Java 404带球衣测试,java,hibernate,testing,jersey,Java,Hibernate,Testing,Jersey,我的休息课: @Path("/Root") public class REST{ @GET @Path("/test") @Produces(MediaType.TEXT_PLAIN) public String testClass() { return "Jersey Test"; } .....etc} 我的球衣测试: public class Test extends JerseyTest { @Override protected AppDescriptor configu

我的休息课:

@Path("/Root")
public class REST{
 @GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
public String testClass() {
    return "Jersey Test";
}
.....etc}
我的球衣测试:

public class Test extends JerseyTest {
@Override
protected  AppDescriptor configure(){
    System.out.println("Here");
    return (new WebAppDescriptor.Builder(REST.class.getPackage().getName())
            .contextParam("contextConfigLocation", "application-context-prm-test.xml").build());
}

@Override
protected TestContainerFactory getTestContainerFactory() {
    return new GrizzlyWebTestContainerFactory();
}
@Test
public void testGet(){
    WebResource webResource = client().resource("http://localhost:9998/Root/test");
    String actual = webResource.getRequestBuilder().get(String.class);
    System.out.println(actual);
}
我似乎总是得到一个404,我已经坚持了四个小时了。我错过了什么


非常感谢

My web.xml:jersey-serlvet/*为什么要编辑掉url模式?我认为问题是,您的REST是私有的,当jersey运行它的注释处理时,我敢肯定,您需要将route类公开。另外,您的映射应该看起来像Jersey Web Application/*抱歉REST类不是私有的。my Web.xml有:Jersey serlvet/*抱歉混淆添加您的应用程序名称,然后像这样根