即使在添加用戶庫中的所有jar後仍然收到錯誤HTTP狀態404 - Servlet mvc-dispatcher不可用已添加到用戶庫中的jars正在使用。儘量不能夠解決無法張貼的截圖,因爲我沒有10分HTTP狀態404 - Servlet mvc-dispatcher不可用已添加的用戶庫正在使用的jar已添加
在web.xmlservlet映射代碼如下種種:
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet.class</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>*.spring</url-pattern>
</servlet-mapping>
我是JSP低於
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="Login.spring" method = "post">
<input type = "text" name = "userName" id = "userName">
<input type = "password" name = "password" id = "password">
<input type = "submit">
</form>
</body>
</html>
我的控制器低於
package com.lnt.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.lnt.services.AuthenticateServices;
@Controller
@RequestMapping("/Login.spring")
public class LoginController {
//@Autowired
AuthenticateServices authenticateService = new AuthenticateServices();
@RequestMapping(method=RequestMethod.POST)
public ModelAndView processCredentials(HttpServletRequest req, HttpServletResponse res)
{
String userName =req.getParameter("userName") ;
String password = req.getParameter("password");
System.out.println("into login controller");
String message = "Invalid credentials";
List<String> userdetails = new ArrayList<String>();
userdetails = authenticateService.verifyUserNameAndPassword(userName, password);
if((userdetails)!=null)
{
message = "welcome" + userName ;
}
return new ModelAndView("results", "message", message) ;
}
}
這裏是堆棧跟蹤:
拋出java.lang.ClassNotFoundException:org.springframework.web.servlet.DispatcherServlet.class 在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader。 (org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095) at org.apache。 catalina.core.StandardWrapper.load(StandardWrapper.java:993) at org.apache.catalina.core.StandardContext.lo adOnStartup(StandardContext.java:4421) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine。啓動(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在sun.reflect.NativeMethodAccessorImpl.invoke(未知來源) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(未知來源) 在java.lang.reflect.Method.invoke(未知來源) 在org.apache.catalina.startup .Bootstrap.start(Bootstrap.java:289) 在org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
難道沒有任何一個誰可以幫助? – user2152452
請勿張貼截圖。你的問題非常模糊。發佈相關代碼,發佈相關配置。發佈預期產出。發佈實際產出。 –
我從來沒有遇到過這個錯誤,這是由於缺少jar文件,即使我添加了包含servlet調度程序類的spring mvc webservlet jar。 我試圖讓使用spring和hibernate – user2152452