Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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 请求的资源不可用。tomcat 7 spring mvc_Java_Spring_Hibernate_Spring Mvc_Tomcat - Fatal编程技术网

Java 请求的资源不可用。tomcat 7 spring mvc

Java 请求的资源不可用。tomcat 7 spring mvc,java,spring,hibernate,spring-mvc,tomcat,Java,Spring,Hibernate,Spring Mvc,Tomcat,我将继续学习本教程 我遇到此错误>>>无法找到请求的资源 web.xml文件内容 <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xm

我将继续学习本教程 我遇到此错误>>>无法找到请求的资源

web.xml文件内容

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<servlet>
    <servlet-name>studentHibernateServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/config/servletConfig.xml</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>studentHibernateServlet</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/jpaContext.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

  <display-name>Archetype Created Web Application</display-name>
</web-app>

作为初学者,请帮助我

您的dispatcher servlet只听
*.html
。您可以调用以此为后缀的url,即:

http://localhost::8080/[YourAppName]/[filename].html
或者,您可以将servlet映射更改为更通用的内容:

<servlet-mapping>
 <servlet-name>studentHibernateServlet</servlet-name>
 <url-pattern>/*</url-pattern>
</servlet-mapping>
更新


您的servlet版本设置为2.5,非常旧。现在是。例如,您可能希望将其更新为至少。因此教程也有点过时,搜索以查找现代的资源。

正在使用哪个url?我也尝试过这样做:localhost:8080/StudentEnrollmentWithSpring/signupt相同的结果请求的资源不可用我遇到此错误缺少工件javax.servlet:servlet api:jar:3.0您需要在pom.xml中添加作为依赖项,并将其设置为“提供”。请告诉我如何知道mvc项目中使用的servlet名称。请参阅web.xml:“studentHibernateServlet”。
<servlet-mapping>
 <servlet-name>studentHibernateServlet</servlet-name>
 <url-pattern>/*</url-pattern>
</servlet-mapping>
 http://localhost::8080/[YourAppName]/signup