Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.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/2/spring/12.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 带嵌入式Jetty静态资源的Spring MVC_Java_Spring_Spring Mvc_Embedded Jetty_Static Resource - Fatal编程技术网

Java 带嵌入式Jetty静态资源的Spring MVC

Java 带嵌入式Jetty静态资源的Spring MVC,java,spring,spring-mvc,embedded-jetty,static-resource,Java,Spring,Spring Mvc,Embedded Jetty,Static Resource,我使用嵌入式码头: ServletContextHandler context = new ServletContextHandler(); JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName); server.setHandler(context); server.start(); 我的spring上下文xml文件是: <mvc:annotation-driven>

我使用嵌入式码头:

 ServletContextHandler context = new ServletContextHandler();
 JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName);
 server.setHandler(context);
 server.start();
我的spring上下文xml文件是:

<mvc:annotation-driven>
    <mvc:message-converters>
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper" ref="mapper"/>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>

<mvc:resources mapping="css/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="images/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="lib/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="swagger-ui.js" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/" location="classpath:/META-INF/resources/"/>

<bean id="mapper" class="com.rest.utils.ObjectMapperFactory"/>

<context:annotation-config/>
<context:component-scan base-package="com.rest"/>
当我试图得到http://localhost:8080/index.html 我得到404HTTP状态码


我做错了什么?为什么我不能获取静态资源?

问题是另一个servlet的映射,它应该是/ans not/*

您在resources文件夹下有index.html文件吗?是的,我有它。