Spring security 应用程序未在使用spring security的tomcat中启动
我正在尝试学习spring安全概念,在我的控制台中,我没有看到任何异常或错误。但我的申请还没有开始。我不知道我错过了什么,谁能帮我 我使用的是Spring4.x,tomcat7 web.xmlSpring security 应用程序未在使用spring security的tomcat中启动,spring-security,Spring Security,我正在尝试学习spring安全概念,在我的控制台中,我没有看到任何异常或错误。但我的申请还没有开始。我不知道我错过了什么,谁能帮我 我使用的是Spring4.x,tomcat7 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/java
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>MTM</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-applicationContect.xml,/WEB-INF/security-applicationContect.xml</param-value>
</context-param>
<!-- Spring listeners -->
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- MVC filter -->
<servlet>
<servlet-name>mvcDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>mvcDispatcher</servlet-name>
<url-pattern>/login</url-pattern>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring filter -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
login.jsp是我在web.xml中的欢迎文件,其主体是:
<body>
<form action="<c:url value='/login.do'/>" id="form" method="post">
Username : <input type="text" id="username" name="username" /> <br />
Password : <input type="password" id="password" name="password" /><br />
<input type="button" value="Submit" name="submit" />
</form>
</body>
我的mvc-applicationContect.xml的配置越来越少
<beans>
<context:annotation-config />
<mvc:annotation-driven />
<context:component-scan base-package="com.auth.pistos.controller" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsps" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
根据日志,您的应用程序已启动“INFO:FrameworkServlet'mvcDispatcher':初始化在116毫秒内完成”您是否找到了正确的url?将您的日志级别设置为调试以获取更多信息。当您点击jsp时,浏览器会显示什么?将日志放入jsp的控制器中并检查日志。您的服务器可能在资源映射方面出现了一些问题。听起来您使用的是IE。请使用其他浏览器获取更具描述性的错误消息。使用的是Chrome和IE,但没有使用。有人能帮我吗。
<body>
<form action="<c:url value='/login.do'/>" id="form" method="post">
Username : <input type="text" id="username" name="username" /> <br />
Password : <input type="password" id="password" name="password" /><br />
<input type="button" value="Submit" name="submit" />
</form>
</body>
This program cannot display the webpage
Most likely causes:
•You are not connected to the Internet.
•The website is encountering problems.
•There might be a typing error in the address.
What you can try:
Check your Internet connection. Try visiting another website to make sure you are connected.
Retype the address.
Go back to the previous page.
<beans>
<context:annotation-config />
<mvc:annotation-driven />
<context:component-scan base-package="com.auth.pistos.controller" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsps" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
package com.auth.pistos.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class LoginController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login() {
return "login";
}
}