簡體   English   中英

使用Spring Security和自定義用戶服務的Oracle數據庫連接問題

[英]oracle database connecting issue using spring security and custom user service

我是spring mvc和spring security的新手。我希望通過用戶每次輸入錯誤的憑據三次時的帳戶鎖定機制來為我們的登錄表單提供安全性。但是spring_security.xml中定義的數據訪問bean類無法與oracle連接數據庫。那么如何解決這個問題。謝謝。

這是我的spring_security.xml

 <?xml version="1.0" encoding="UTF-8"?>

 <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-3.0.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.2.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" login-processing-url="/j_spring_security_check" default-target-url="/welcome" always-use-default-target="false"
            authentication-failure-url="/login?error" username-parameter="username" password-parameter="password" />
        <logout logout-success-url="/login?logout" delete-cookies="JSESSIONID" invalidate-session="true" />
        <!-- enable csrf protection -->
        <csrf />

    </http>




    <beans:bean id="customUserDetailsService" class="com.dxb.users.service.CustomUserDetailsService">
            <beans:property name="usersByUsernameQuery" value="select * from users where username = ?"/>
            <beans:property name="authoritiesByUsernameQuery" value="select username, role from user_roles where username =?" />
            <beans:property name="dataSource" ref="dataSource" />
        </beans:bean>   




        <beans:bean id="userDetailsDao" class="com.dxb.users.dao.UserDetailsDaoImpl" >
            <beans:property name="dataSource" ref="dataSource" />
        </beans:bean>




        <beans:bean id="authenticationProvider" class="com.dxb.web.handler.LimitLoginAuthenticationProvider">
            <beans:property name="userDetailsService" ref="customUserDetailsService" />
            <beans:property name="userDetailsDao" ref="userDetailsDao" />
        </beans:bean>

         <authentication-manager>

           <authentication-provider  ref="authenticationProvider"></authentication-provider>

        </authentication-manager> 



</beans:beans>

這是spring_database.xml

    <?xml version="1.0" encoding="UTF-8"?>

 <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.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@192.168.1.7:1521/XE" />
        <property name="username" value="procdb" />
        <property name="password" value="procdbadmin" />
    </bean>

</beans>

這是mvc_dispatcher_servlet

    <?xml version="1.0" encoding="UTF-8"?>

 <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.dxb.*" />
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>


    </bean>

</beans>

和web.xml

    <web-app id="WebApp_ID" version="2.5"
    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_5.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-database.xml,
                    /WEB-INF/spring-security.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>

    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
</web-app>

這里是上面代碼的堆棧跟蹤

    Jul 27, 2016 4:16:56 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;D:\app\user\product\11.2.0\client_1\bin;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Java\jdk1.7.0\bin;C:\Program Files (x86)\Java\jre7\lib\ext;%C:\Program Files\Apache Software Foundation\apache-maven-3.3.9\bin%;C:\Program Files (x86)\Java\jdk1.7.0\bin;D:\software\eclipse;;.
Jul 27, 2016 4:16:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:LoginAttempt' did not find a matching property.
Jul 27, 2016 4:16:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:test' did not find a matching property.
Jul 27, 2016 4:16:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringHibernateEx' did not find a matching property.
Jul 27, 2016 4:16:56 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 27, 2016 4:16:56 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 710 ms
Jul 27, 2016 4:16:57 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 27, 2016 4:16:57 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet).
log4j:WARN Please initialize the log4j system properly.
Jul 27, 2016 4:16:57 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'sdnext'
Jul 27, 2016 4:17:00 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\b2bAER_v1.0\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\test\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 27, 2016 4:17:00 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jul 27, 2016 4:17:00 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jul 27, 2016 4:17:00 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Wed Jul 27 16:17:00 IST 2016]; root of context hierarchy
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-database.xml]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-security.xml]
Jul 27, 2016 4:17:01 PM org.springframework.security.core.SpringSecurityCoreVersion performVersionChecks
INFO: You are running with Spring Security Core 3.2.3.RELEASE
Jul 27, 2016 4:17:01 PM org.springframework.security.config.SecurityNamespaceHandler <init>
INFO: Spring Security 'config' module version is 3.2.3.RELEASE
Jul 27, 2016 4:17:01 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'hasRole('role_admin')' for /admin**
Jul 27, 2016 4:17:01 PM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder
INFO: Checking sorted filter chain: [Root bean: class [org.springframework.security.web.access.channel.ChannelProcessingFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 100, Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.csrf.CsrfFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 600, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 700, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 1100, Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1500, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1600, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2000, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2100, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2200, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2300]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.parsing.FailFastProblemReporter warning
WARNING: Configuration problem: Overriding globally registered AuthenticationManager
Offending resource: ServletContext resource [/WEB-INF/spring-security.xml]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'org.springframework.security.authenticationManager': replacing [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.parsing.FailFastProblemReporter warning
WARNING: Configuration problem: Overriding globally registered AuthenticationManager
Offending resource: ServletContext resource [/WEB-INF/spring-security.xml]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'org.springframework.security.authenticationManager': replacing [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.parsing.FailFastProblemReporter warning
WARNING: Configuration problem: Overriding globally registered AuthenticationManager
Offending resource: ServletContext resource [/WEB-INF/spring-security.xml]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'org.springframework.security.authenticationManager': replacing [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Jul 27, 2016 4:17:01 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1bfcbd8: defining beans [dataSource,org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.PortResolverImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,requestDataValueProcessor,org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.access.channel.ChannelDecisionManagerImpl#0,org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,customUserDetailsService,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#1,userDetailsDao,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#2,authenticationProvider,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#3]; root of factory hierarchy
Jul 27, 2016 4:17:01 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: oracle.jdbc.OracleDriver
Jul 27, 2016 4:17:01 PM org.springframework.security.web.access.channel.ChannelProcessingFilter afterPropertiesSet
INFO: Validated configuration attributes
Jul 27, 2016 4:17:01 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.access.channel.ChannelProcessingFilter@1eb620c, org.springframework.security.web.context.SecurityContextPersistenceFilter@7206ea, org.springframework.security.web.csrf.CsrfFilter@240ba6, org.springframework.security.web.authentication.logout.LogoutFilter@78f1a0, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@3f562f, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@334482, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1d6d6cf, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1b0d8fc, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@17599ab, org.springframework.security.web.session.SessionManagementFilter@1bbdb89, org.springframework.security.web.access.ExceptionTranslationFilter@4a38ae, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@cf32f0]
Jul 27, 2016 4:17:02 PM org.springframework.security.config.http.DefaultFilterChainValidator checkLoginPageIsntProtected
INFO: Checking whether login URL '/login' is accessible with your configuration
Jul 27, 2016 4:17:02 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 1161 ms
Jul 27, 2016 4:17:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'mvc-dispatcher'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization started
Jul 27, 2016 4:17:02 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Wed Jul 27 16:17:02 IST 2016]; parent: Root WebApplicationContext
Jul 27, 2016 4:17:02 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]
Jul 27, 2016 4:17:02 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1f7a4f8: defining beans [mainController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1bfcbd8
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Root mapping to handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/welcome**] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/welcome**.*] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/welcome**/] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/admin**] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/admin**.*] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/admin**/] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/login] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/login.*] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/login/] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/403] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/403.*] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/403/] onto handler 'mainController'
Jul 27, 2016 4:17:02 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization completed in 440 ms
Jul 27, 2016 4:17:02 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\b2bAER_v1.0\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\LoginAttempt\WEB-kINF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 27, 2016 4:17:02 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 27, 2016 4:17:02 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 27, 2016 4:17:02 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15  config=null
Jul 27, 2016 4:17:02 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5691 ms
Jul 27, 2016 4:17:15 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
Jul 27, 2016 4:17:15 PM org.springframework.jdbc.support.SQLErrorCodesFactory <init>
INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]

我的猜測是,來自CustomUserDetailsS​​ervice的sql之一是根本原因。

消息“ INFO:SQLErrorCodes已加載:”是由於JdbcTemplate拋出異常。

確保CustomUserDetailsS​​ervice或userDetailsDao沒有吞下任何異常

我將驗證以下內容:

  1. 在數據庫和架構的上下文中,所有sql的語法都是正確的(只需嘗試直接在數據庫上執行它們)。
  2. 所有占位符(即“?”)均已正確填充。
  3. 數據源指向正確的SID,而正確的用戶名指向所需的模式

也可以看看:
Spring Security登錄不適用於Oracle
使用數據庫登錄Spring Security表單

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM