简体   繁体   English

使用Spring Security和自定义用户服务的Oracle数据库连接问题

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

I am new to spring mvc and spring security.I want to provide security for our login form in terms of account lockout mechanism whenever user enter wrong credentials three times.But my data access bean class defined in spring_security.xml is unable to connect with oracle database.So how to solve this issue.Thank you. 我是spring mvc和spring security的新手。我希望通过用户每次输入错误的凭据三次时的帐户锁定机制来为我们的登录表单提供安全性。但是spring_security.xml中定义的数据访问bean类无法与oracle连接数据库。那么如何解决这个问题。谢谢。

here is my spring_security.xml 这是我的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>

here is spring_database.xml 这是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>

here is mvc_dispatcher_servlet 这是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>

and web.xml 和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>

here the stack trace for above code 这里是上面代码的堆栈跟踪

    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]

My guess will be that one of the sqls from CustomUserDetailsService are the root cause. 我的猜测是,来自CustomUserDetailsS​​ervice的sql之一是根本原因。

The message “INFO: SQLErrorCodes loaded:” is due to the fact the JdbcTemplate throw an exception. 消息“ INFO:SQLErrorCodes已加载:”是由于JdbcTemplate抛出异常。

Make sure that the CustomUserDetailsService or the userDetailsDao are not swallowing any exceptions 确保CustomUserDetailsS​​ervice或userDetailsDao没有吞下任何异常

I would verify the following: 我将验证以下内容:

  1. The syntax of all sqls is correct in the context of your database and schema (just try executing them directly on the database). 在数据库和架构的上下文中,所有sql的语法都是正确的(只需尝试直接在数据库上执行它们)。
  2. All placeholders (ie the '?') are poplated coreectly. 所有占位符(即“?”)均已正确填充。
  3. The data source pointing to the correct SID with the correct user name pointing to the desired schema 数据源指向正确的SID,而正确的用户名指向所需的模式

See also: 也可以看看:
spring security login not working with oracle Spring Security登录不适用于Oracle
Spring Security form login using database 使用数据库登录Spring Security表单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM