gpt4 book ai didi

spring - 原因:在Spring Security中无法将空值或空值传递给构造函数

转载 作者:行者123 更新时间:2023-12-01 14:08:50 25 4
gpt4 key购买 nike

尝试通过LDAP通过LDAP对用户进行身份验证时,出现以下错误。

Reason: Cannot pass null or empty values to constructor.

谁能告诉我做错了什么?
<?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.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

<http auto-config="true">
<intercept-url pattern="/**" access="ROLE_USER,ROLE_ADMIN" />
<intercept-url pattern="/administrator.htm" access="ROLE_ADMIN" />
<!-- <form-login login-page="/dashboard.htm" default-target-url="/dashboard.htm" authentication-failure-url="/ExceptionPage.jsp" /> -->
<form-login/>
</http>

<authentication-manager>
<authentication-provider>
<!-- <user-service>
<user name="20022263" password="da" authorities="ROLE_USER" />
<user name="20039004" password="da" authorities="ROLE_ADMIN" />
</user-service> -->
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT a.GLOBALID AS username, a.PASSWORD AS password, a.Enabled AS enabled FROM EU_MAS_TBUSER a WHERE a.GLOBALID=?"
authorities-by-username-query="select eu.USERNAME AS username, r.ACCESSROLEID AS authority from EU_MAS_TBUSER eu, EU_MAS_TBUSERS_ROLE r where eu.GLOBALID = r.GLOBALID and eu.GLOBALID=?"
role-prefix="ROLE_"/>
</authentication-provider>

</authentication-manager>

</beans:beans>

最佳答案

产生异常的实际行是here。创建用户对象的相关代码是here

因此,我最好的猜测是数据库中用户的密码字段为空。

请注意,如果要发布这样的错误,则从服务器日志中提供stacktrace和相关的调试输出,将容易得多。

关于spring - 原因:在Spring Security中无法将空值或空值传递给构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12638209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com