這是我的代碼。我不知道這有什麼問題。在DispatcherServlet中找不到具有URI [***]的HTTP請求的映射
<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>Spring Security Application</display-name>
<!-- Spring MVC -->
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml,
/WEB-INF/spring-database.xml
</param-value>
</context-param>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern> //</url-pattern>
</filter-mapping>
</web-app>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<!-- enable use-expressions -->
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
<!-- access denied page -->
<access-denied-handler error-page="/403" />
<form-login
login-page="/login"
default-target-url="/welcome"
authentication-failure-url="/login?error"
username-parameter="username"
password-parameter="password" />
<logout logout-success-url="/login?logout" />
<!-- enable csrf protection -->
<csrf/>
</http>
<!-- Select users and user_roles from database -->
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query=
"select USERNAME as username, PASSWORD as password,'true' as enabled from USERS where USERNAME=?"
authorities-by-username-query=
"select USERNAME as username, ROLE as role from USER_ROLES where USERNAME =? " />
</authentication-provider>
</authentication-manager>
</beans:beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe" />
<property name="username" value="system" />
<property name="password" value="sekhar" />
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mkyong.*" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
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;
@Controller
public class MainController {
@RequestMapping(value = { "/", "/welcome**" }, method = RequestMethod.GET)
public ModelAndView defaultPage() {
ModelAndView model = new ModelAndView();
model.addObject("title", "Spring Security Login Form - Database Authentication");
model.addObject("message", "This is default page!");
model.setViewName("hello");
return model;
}
@RequestMapping(value = "/admin**", method = RequestMethod.GET)
public ModelAndView adminPage() {
ModelAndView model = new ModelAndView();
model.addObject("title", "Spring Security Login Form - Database Authentication");
model.addObject("message", "This page is for ROLE_ADMIN only!");
model.setViewName("admin");
return model;
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout) {
ModelAndView model = new ModelAndView();
if (error != null) {
model.addObject("error", "Invalid username and password!");
}
if (logout != null) {
model.addObject("msg", "You've been logged out successfully.");
}
model.setViewName("login");
return model;
}
//for 403 access denied page
@RequestMapping(value = "/403", method = RequestMethod.GET)
public ModelAndView accesssDenied() {
ModelAndView model = new ModelAndView();
//check if user is login
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (!(auth instanceof AnonymousAuthenticationToken)) {
UserDetails userDetail = (UserDetails) auth.getPrincipal();
System.out.println(userDetail);
model.addObject("username", userDetail.getUsername());
}
model.setViewName("403");
return model;
}
}
的警告給出波紋管:
Apr 21, 2017 9:05:31 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING:
[SetPropertiesRule] {服務器/服務/發動機/主機/上下文} 財產 '源' 設置爲「組織。 eclipse.jst.jee.server:Vendorapp'
未找到匹配的屬性。 2017年4月21日上午9時05分31秒org.apache.tomcat.util.digester.SetPropertiesRule開始 警告:[SetPropertiesRule] {Server/Service/Engine/Host/Context}將屬性'源'設置爲 '組織。 eclipse.jst.jee.server:SpringSecurityDemo'沒有找到匹配屬性 。 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:服務器版本:Apache Tomcat/8.0.33 2017年4月21日上午9時05分31秒org.apache.catalina。 startup.VersionLoggerListener log INFO:Server built:Mar 18 2016 20:31:49 UTC 2017年4月21日9:05:31 org.apache.catalina.startup.VersionLoggerListener日誌 信息:服務器編號:8.0.33.0 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:操作系統名稱:Windows 10 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 INFO:OS版本:10.0 2017年4月21日上午9:05:31 org.apache.catalina.startup.Version LoggerListener日誌 信息:體系結構:amd64 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:Java Home:C:\ Program Files \ Java \ jdk1.8.0_91 \ jre 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:JVM版本:1.8.0_91-b14 2017年4月21日上午9時05分31秒org.apache.catalina.startup。 VersionLoggerListener日誌 INFO:JVM供應商:Oracle Corporation 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:CATALINA_BASE:C:\ dummy.metadata.plugins \ org.eclipse.wst .server.core \ tmp1 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:CATALINA_HOME:F:\ Tomcat8.0 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:命令行參數:-Dcatalina.base = C:\ dummy.metadata .plugins \ org.eclipse.wst.server.core \ tmp1 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:命令行參數:-Dcatalina.home = F:\ Tomcat8.0 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:命令行參數:-Dwtp.deploy = C:\ dummy.metadata.plugins \ org.eclipse.wst .server.core \ tmp1 \ wtpwebapps 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:命令行參數:-Djava.endorsed.dirs = F:\ Tomcat8.0 \贊同 2017年4月21日上午9時05分31秒org.apache.catalina.startup.VersionLoggerListener日誌 信息:命令行參數:-Dfile.encoding = Cp1252 2017年4月21日上午9時05分31秒org.apache.catalina 。核心。AprLifecycleListener生命週期事件 信息:在生產環境中允許最佳性能的基於APR的Apache Tomcat本機庫在 java.library.path上沒有找到:C:\ Program Files \ Java \ jdk1.8.0_91 \ jre \ bin; C :\ WINDOWS \ Sun \ Java \ bin; C:\ WINDOWS \ system32; C:\ WINDOWS; C:/ Program Files/Java/jre1.8.0_91/bin/server; C:/ Program Files/Java/jre1 C:\ ProgramData \ Oracle \ C:\ Program Files \ Java \ jre1.8.0_91 \ lib \ amd64; F:\ oraclexe \ app \ oracle \ product \ 11.2.0 \ server \ bin; Java \ javapath; C:\ oraclexe \ app \ oracle \ product \ 11.2.0 \ server \ bin; C:\ app \ product \ 12.1.0 \ dbhome_1 \ bin; C:\ Program 文件(x86)\ Java \ jdk1.8.0_65 \ bin; C:\ Program Files(x86)\ Intel \ TXE Components \ TCS \; C:\ Program Files \ Intel \ TXE Comp C:\ WINDOWS \ C:\ WINDOWS \ System32 \ Wbem; C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program Files \ Microsoft SQL Server \客戶端SDK \ ODBC \ 110 \ Tools \ Binn \; C:\ Program 文件(x86)\ Microsoft SQL Server \ 120 \ Tools \ Binn \; C:\ Program Files \ Microsoft SQL Server \ 120 \ Tools \ Binn \; C:\ Program Files \ Microsoft SQL Server \ 120 \ DTS \ Binn \; C:\ Program Files(x86)\ Microsoft SQL Server \ 120 \ Tools \ Binn \ ManagementStudio \; C:\ Program Files ( x86 \ Microsoft SQL Server \ 120 \ DTS \ Binn \; C:\ apache-ant-1.9.7 \ bin; C:\ Program Files \ Git \ cmd; C:\ Program Files \ Git \ mingw64 \ bin ; C:\ Program Files \ Git \ usr \ bin; C:\ Program Files(x86)\ Skype \ Phone \; C:\ Users \ GUNA SEKHAR \ AppData \ Local \ Micro soft \ WindowsApps; C:\ apache-maven-3.2.2 \ bin; C:\ eclipse mars.2 ;;。 2017年4月21日上午9時05分32秒org.apache.coyote.AbstractProtocol初始化 INFO:初始化ProtocolHandler [「http-nio-7070」] 2017年4月21日上午9時05分32秒org.apache.tomcat。 util.net.NioSelectorPool getSharedSelector 信息:使用servlet的共享選擇器寫入/讀取 2017年4月21日上午9時05分32秒org.apache.coyote.AbstractProtocol初始化 信息:初始化ProtocolHandler [「ajp-nio-8009」 ] 2017年4月21日上午9時5分32秒org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息:使用共享選擇器進行servlet寫入/讀取 2017年4月21日上午9時05分32秒org.apache .catalina.startup.Catalina加載 信息:1798年處理的初始化ms Apr 21,2 017 9:05:32 AM org.apache.catalina.core.StandardService startInternal 信息:啓動服務Catalina 2017年4月21日上午9時05分32秒org.apache.catalina.core.StandardEngine startInternal 信息:啓動Servlet引擎:Apache Tomcat/8.0.33 2017年4月21日上午9時05分33秒org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 信息:使用[SHA1PRNG]創建會話ID生成的SecureRandom實例需要[204]毫秒。 2017年4月21日上午9:05:42 org.apache.jasper.servlet.TldScanner scanJars 信息:至少有一個JAR掃描了頂級域名但尚未包含頂級域名。啓用此記錄器的調試日誌記錄以獲取完整的JAR列表 ,其中 已被掃描,但未找到TLD。在掃描期間跳過不需要的JAR 可以縮短啓動時間並縮短JSP編譯時間。 2017年4月21日上午09時05分42秒org.apache.catalina.core.ApplicationContext登錄 信息:在類路徑 2017年4月21日上午09時05分42秒org.apache.catalina.core沒有檢測到春天WebApplicationInitializer類型。 ApplicationContext的日誌 信息:初始化春根WebApplicationContext的 2017年4月21日上午09時05分42秒org.springframework.web.context.ContextLoader initWebApplicationContext 信息:根的WebApplicationContext:初始化開始 2017年4月21日上午09時05分43秒org.springframework.web.context.support。XmlWebApplicationContext prepareRefresh 信息:刷新根WebApplicationContext:啓動日期[星期五Apr 21 09:05:43 IST 2017];上下文層次結構的根 2017年4月21日上午9時05分43秒org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:從ServletContext資源加載XML bean定義[/WEB-INF/spring-security.xml] 2017年4月21日上午09時05分44秒org.springframework.security.core.SpringSecurityCoreVersion performVersionChecks 信息:您使用Spring Security核心4.2.1.RELEASE 2017年4月21日上午09時05分44秒組織運行。 springframework.security.core.SpringSecurityCoreVersion performVersionChecks 警告:****建議您在此版本中使用Spring 4.3.5.RELEASE或更高版本。您正在運行:4.3.4.RELEASE 2017年4月21日上午9時05分44秒org.springframework.security.config.SecurityNamespaceHandler 信息:Spring Security'config'模塊版本是4.2.1.RELEASE 2017年4月21日上午9:05:44 org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap INFO:爲/ admin **創建訪問控制表達式屬性'hasRole('ROLE_ADMIN')' 2017年4月21日9:05:44 AM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder 信息:檢查排序的過濾器鏈:[Root bean:class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 200,Root bean:class [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 400,Root bean:class [org.springframework.security.web.header.HeaderWriterFilter];範圍=; abstract = false; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = true;初級= FALSE; factoryBeanName = NULL; factoryMethodName = null; initMethodName = NULL; destroyMethodName = null, order = 500,Root bean:class [org.springframework.security.web.csrf.CsrfFilter];範圍=; abstract = false; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = true;初級= FALSE; factoryBeanName = NULL; factoryMethodName = null; initMethodName = NULL; destroyMethodName = null, order = 700,Root bean:class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 800, , order = 1200,root bean:class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 1600,Root bean:class [org.springframework.security.web.savedrequest。RequestCacheAwareFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 1700,Root bean:class [null];範圍=; abstract = false; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = true;初級= FALSE; factoryBeanName = org.springframework.security.config.http.HttpConfigurationBuilder $ SecurityContextHolderAwareRequestFilterBeanFactory#0; factoryMethodName = getBean; initMethodName = NULL; destroyMethodName = null,order = 1800,Root bean:class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 2100,Root bean:class [org.springframework.security.web.session.SessionManagementFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = null,order = 2200,Root bean:class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope =;抽象= FALSE; lazyInit = FALSE; autowireMode = 0; dependencyCheck = 0; autowireCandidate = TRUE;初級= FALSE; factoryBeanName = null; factoryMethodName = NULL; initMethodName = NULL; destroyMethodName = NULL,爲了= 2300, , 爲了= 2400] 2017年4月21日上午09點05分44秒org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO:從ServletContext的資源裝載XML bean定義[/WEB-INF/spring-database.xml] 2017年4月21日上午09點05分45秒org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName INFO:加載JDBC驅動:oracle.jdbc.driver.OracleDriver 四月21,2017 9:05:46 AM org.springframework.security.provisioning.JdbcUserDetailsManager initDao 信息:沒有認證管理器設置。在更改密碼時重新認證用戶將不會執行。 2017年4月21日上午9時05分46秒org.springframework.security.web.DefaultSecurityFilterChain 信息:創建過濾器鏈:[email protected]1, [org.springframework.security .web.context.SecurityContextPersistenceFilter @ 65fc7ca7, org.springframework.secu[email protected]c00f385, [email protected]919, org.springframework.security。 [email protected], org.[email protected]674f28ec, org.springframework.s[email protected]6cd8635b, org.springframework.security.web.authe [email protected], org.sp[email protected]60d4ae79, org.springframework.[email protected]7ec2e2c7, org.springframework.security.web.authentication.AnonymousAuthenticationFilter @ 51af94ff, o[email protected]284b2524, org[email protected]6d29e132, org.springframework.security.web.access.intercept。FilterSecurityInterceptor @ 494f28a] 2017年4月21日上午09時05分46秒org.springframework.security.config.http.DefaultFilterChainValidator checkLoginPageIsntProtected 信息:檢查登錄網址「/登錄」是否與您的配置 2017年4月21日9訪問:05:46 AM org.springframework.web.context.ContextLoader initWebApplicationContext 信息:根的WebApplicationContext:初始化在3774毫秒完成 2017年4月21日上午09時05分46秒org.apache.catalina.core.ApplicationContext登錄 信息:初始化Spring FrameworkServlet'mvc-dispatcher' 2017年4月21日上午9時05分46秒org.springframework.web.servlet.DispatcherServlet initServletBean INFO:FrameworkServlet'mvc-dispatcher ':initialization started 2017年4月21日上午9時05分46秒org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh 信息:刷新命名空間'mvc-dispatcher-servlet'的WebApplicationContext:啓動日期[星期五Apr 21 09 :05:46 IST 2017]; 父:根WebApplicationContext的 2017年4月21日上午09時05分46秒org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:從ServletContext的資源加載XML bean定義[/ WEB-INF/MVC-調度員的servlet .XML] 2017年4月21日上午09點05分47秒org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor INFO:JSR-330 'javax.inject.Inject' 註釋發現支持自動裝配 2017年4月21日上午9:05:47 org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 信息:映射的URL路徑[/登錄]到處理程序'mainController' 2017年4月21日9:05:4 7 AM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 信息:映射的URL路徑[/login.*]到處理器'mainController' 2017年4月21日上午9時05分47秒org.springframework.web .servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/登錄/]到處理程序 'mainController' 2017年4月21日上午09點05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 信息:根映射到處理程序 'mainController' 2017年4月21日上午09時05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 我NFO:映射的URL路徑[/ welcome **]到處理程序'mainController' 2017年4月21日上午9時05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 信息:映射的URL路徑[/ url]歡迎** *]到處理程序 'mainController' 2017年4月21日上午09點05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/歡迎** /]到處理程序 'mainController' 2017年4月21日上午09點05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/管理**]到處理程序 'mainController' 四月21,2017 9:05:47 AM org.springframework.we b.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler 信息:映射的URL路徑[/admin**.*]到處理程序'mainController' 2017年4月21日上午9時05分47秒org.springframework.web.servlet.mvc .annotation.DefaultAnnotationHandlerMapping registerHandler 信息:映射的URL路徑[/ admin ** /]到處理程序'mainController' 2017年4月21日上午9時05分47秒org.springframework.web.servlet.mvc.annotation。DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/ 403]到處理程序 'mainController' 2017年4月21日上午09點05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/403.*]到處理程序 'mainController' 2017年4月21日上午09點05分47秒org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler INFO:映射的URL路徑[/ 403 /]到處理程序'mainController' 2017年4月21日上午9時05分48秒org.springframework.web.servlet.DispatcherServlet initServletBean INFO:FrameworkServlet'mvc-dispatcher':初始化在1592年完成ms 2017年4月21日上午9時05分55秒org.apache.jasper.servlet.TldScanner scanJars 信息:至少有一個JAR掃描了頂級域名但尚未包含任何頂級域名。啓用此記錄器的調試日誌記錄以獲取完整的JAR列表 ,其中 已被掃描,但未找到TLD。在掃描期間跳過不需要的JAR 可以縮短啓動時間並縮短JSP編譯時間。 2017年4月21日上午9點05分56秒org.apache.catalina.core.ApplicationContext日誌 信息:沒有在類路徑上檢測到Spring WebApplicationInitializer類型 2017年4月21日上午9:05:56 org.apache.coyote.AbstractProtocol start 信息:啓動ProtocolHandler [「http-nio-7070」] 2017年4月21日上午9時05分56秒org.apache.coyote.AbstractProtocol開始 信息:啓動ProtocolHandler [「ajp-nio-8009」] Apr 21 ,2017 9:05:56 AM org.apache.catalina.startup.Catalina start INFO:服務器在23755啓動ms 2017年4月21日上午9時06分07秒org.springframework.web.servlet.PageNotFound noHandlerFound 警告:在Dispat中找不到使用URI [/ SpringSecurityDemo/j_spring_security_check]的HTTP請求的映射cherServlet 名爲 'MVC-調度'
我使用Oracle 11g數據庫,並收到此錯誤,同時登錄。請告訴如何解決它。 我創建了一個數據庫,如下所示。
create table users(username varchar(90) primary key, password varchar(90), enabled smallint default 1);
create table user_roles(user_role_id int,username varchar(90) not null , role varchar(90) not null, constraint fk_username foreign key(username) references users(username),constraint user_role_pk primary key(user_role_id));
create sequence user_role_pk start with 1;
insert into users values('abc','123456',1);
insert into users values(2,'alex','123456');
insert into user_roles(username, role,user_role_id) values('abc','ROLE_ADMIN',1);
insert into user_roles values(2,'alex','ROLE_USER');
這句話有什麼問題?
警告:未找到HTTP請求與URI [/ SpringSecurityDemo/j_spring_security_check在DispatcherServlet的名稱爲 'MVC-調度' 我映射使用用戶名和密碼登錄時出現此錯誤 –