java - spring security sql-error-codes.xml ,没有发现异常跟踪
问题描述
我已经为我的应用程序配置了 spring 安全性,但由于以下信息而卡在一个地方:org.springframework.beans.factory.xml.XmlBeanDefinitionReader-从类路径资源加载 XML bean 定义 [org/springframework/jdbc/support/sql-错误代码.xml]。我有谷歌但找不到原因
我的代码:-
<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">
<http security="none" pattern="/login"></http>
<http auto-config="false" use-expressions="true">
<intercept-url pattern="/*" access="hasRole('ROLE_USER')" />
<!-- login-processing-url="" -->
<form-login login-page="/login" default-target-url="/" authentication-failure-url="/login?error" username-parameter="username" password-parameter="password" />
<logout logout-success-url="/login?logout" invalidate-session="true" />
</http>
<!-- <authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource" />
</authentication-provider>
</authentication-manager> -->
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT USERNAME,PASSWORD,ENABLED from SCOTT.TBL_USERS WHERE USERNAME=?;"
authorities-by-username-query="SELECT u.USERNAME, r.ROLENAME FROM SCOTT.TBL_USERS u,SCOTT.TBL_USER_ROLE r WHERE u.USERNAME = r.USERNAME
AND u.USERNAME=?;" />
</authentication-provider>
</authentication-manager>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<beans:property name="url" value="jdbc:oracle:thin:@192.168.6.147:1521:orcl" />
<beans:property name="username" value="SCOTT" />
<beans:property name="password" value="IPORTMAN" />
</beans:bean>
</beans:beans>
我创建了自己的表:- CREATE TABLE "SCOTT"."USERS" ("USERNAME" VARCHAR2(50) NOT NULL PRIMARY KEY, "PASSWORD" VARCHAR2(50) NOT NULL, "ENABLED" NUMBER(22 , 0) NOT无效的 );
和
创建表“SCOTT”。“TBL_USER_ROLE”(用户名varchar(50)不为空,权限varchar(50)不为空,约束fk_authorities_users外键(用户名)引用“SCOTT”。“TBL_USERS”(用户名));我如何追踪问题,为什么我的登录总是失败,我的登录页面出现了我已经给出了用户名和密码,但它只是在控制台 sql-error-codes.xml 中弹出。
解决方案
when we are using Oracle database then the table structure is like below
CREATE TABLE users (username VARCHAR(50) PRIMARY KEY, password VARCHAR(50) NOT NULL, enabled VARCHAR(50) NOT NULL)
create table authorities (
username varchar(50) not null,
authority varchar(50) not null,
constraint fk_authorities_users foreign key(username) references users(username));
create unique index ix_auth_username on authorities (username,authority);
the problem was in table structure.
推荐阅读
- javascript - 我在谷歌表格“TypeError:无法读取未定义的searchRecord @ Code.gs:213的属性'0'”上不断收到此错误
- swift - 导入 Swift 包时,Xcode 链接器可以删除未使用的代码吗?
- python - Python discord bot屏幕录制功能不会停止录制
- shell - 如何仅从文件的创建/修改日期中提取日期?
- asp.net-web-api - 根据响应状态代码 Audit.Net 过滤请求
- c# - 如何使用轮询 LoadBalancing 访问 GRPC 服务器以在 AKS 中长时间运行进程?
- reactjs - 运行反应本机应用程序时显示错误
- performance - SpaCy NER 模型的实体级别的 PRF 值
- xml - 获取传入 XML 中元素的所有值
- reactjs - 尝试连接时的django csrf身份验证错误反应