Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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
Eclipse 使用maven单元测试访问jsp资源时出现错误500_Eclipse_Jsp_Unit Testing_Maven_Jetty - Fatal编程技术网

Eclipse 使用maven单元测试访问jsp资源时出现错误500

Eclipse 使用maven单元测试访问jsp资源时出现错误500,eclipse,jsp,unit-testing,maven,jetty,Eclipse,Jsp,Unit Testing,Maven,Jetty,我在尝试通过单元测试访问jsp时出错500次,单元测试在eclipse中运行得非常好,但是在通过maven运行时出错500次 我用过: mvn clean package -> which runs all the unit tests 示例代码: // Starting a jetty server jettyServer.start(); .... // URL to the page the test wanted to validate U

我在尝试通过单元测试访问jsp时出错500次,单元测试在eclipse中运行得非常好,但是在通过maven运行时出错500次

我用过:

mvn clean package -> which runs all the unit tests
示例代码:

    // Starting a jetty server
    jettyServer.start();
    ....
    // URL to the page the test wanted to validate
    URL url = new URL(getUrl() + "/Stats.jsp");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

    try {
       conn.setRequestMethod("GET");
       conn.setRequestProperty("Accept", "text/xml");
    ....
    // FAILING HERE WITH 500
    assertEquals("Didn't get a succesful http response, output: " + conn.getResponseMessage(), 200, conn.getResponseCode());
jsp位于以下位置: src/main/resources/jsp

我尝试为参考库中所有与jetty相关的jar文件添加mvn依赖项,现在它们也在Maven依赖项下,但是,这似乎没有多大帮助

稍后在日志中,我看到一些有趣的警告,不确定是否相关:

2015-05-24 14:35:08,362 WARN  [qtp82416174-739] servlet.ServletHandler(620):
javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.jasper.compiler.JspUtil.expandClassPath(Ljava/util/List;)Ljava/util/List;
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:400)
at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.jasper.compiler.JspUtil.expandClassPath(Ljava/util/List;)Ljava/util/List;
at org.apache.jasper.compiler.Jsr199JavaCompiler.setClassPath(Jsr199JavaCompiler.java:123)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:348)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
你知道会出什么问题吗?我是否错过了jsp设置,或者mvn配置中是否有任何特殊需要,以使jetty server能够为jsp服务

谢谢你的帮助