Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.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 当文件可用时,在DispatcherServlet中找不到URI为[]的HTTP请求的映射_Java_Spring_Embedded Jetty - Fatal编程技术网

Java 当文件可用时,在DispatcherServlet中找不到URI为[]的HTTP请求的映射

Java 当文件可用时,在DispatcherServlet中找不到URI为[]的HTTP请求的映射,java,spring,embedded-jetty,Java,Spring,Embedded Jetty,我一次又一次地犯这个错误 web.xml <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/

我一次又一次地犯这个错误

web.xml

<web-app id="WebApp_ID" version="2.4"
     xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>brb</display-name>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
    <servlet-name>brb</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>brb</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>
我尝试在嵌入式Jetty下运行这个简单的应用程序,但由于某些原因,SpringMVC无法查看视图文件

更新:我正在尝试打开“localhost:9123/”

注意:未测试

首先,尝试在
web.xml
中映射您的

<servlet-mapping>
    <servlet-name>brb</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

我希望这有帮助。

在使用什么URI查询时?对不起。我没有给它定尺寸。Just localhost:9123/您是否已将应用程序映射到root?换句话说,“localhost:9123/”是否解析为您的web应用程序?如果没有,这可能会有所帮助-我检查过:这肯定是我的应用程序,有警告:在名为“org.springframework.web.servlet.DispatcherServlet-284d5543”的DispatcherServlet中找不到URI为[/index.jsp]的HTTP请求的映射。另外,一些静态响应主体也可以正常工作
@Controller
public class BrbController{


@RequestMapping(value = "/", method = GET)
public String index() {
    System.out.println(this.getClass().getClassLoader().getResource("index.jsp")); // i check is file is available, actually I've coppied it in all resource directories presented
    return "index.jsp";
}
<servlet-mapping>
    <servlet-name>brb</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>brb</servlet-name>
    <url-pattern>/api</url-pattern>
</servlet-mapping>
@RequestMapping(value = "/start", method = GET)