【发布时间】:2015-02-17 02:45:33
【问题描述】:
我似乎陷入了困境,无法弄清楚发生了什么。我目前正在尝试使用 Spring 安全性将用户从使用 Sha-256 加密迁移到 Bcyrpt。我查看了 this answer 并设置了该类,但是在 Tomcat 启动时出现以下错误:
ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:307) - Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.security.authentication.dao.DaoAuthenticationProvider<200c><200b>] for bean with name 'customAuthenticationProvider' defined in file [/var/lib/tomcat7/webapps/UKExtranet/WEB-INF/classes/META-INF/spring/applicationContext-security.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.security.authentication.dao.DaoAuthenticationProvider<200c><200b>
虽然这看起来很简单(ClassNotFoundException),但该类肯定存在,但我已经检查过,甚至让同事检查以防我发疯,他也说它在那里。
下面是我的 applicationContext-security.xml 文件的相关部分:
<bean id='bCryptPasswordEncoder'
class='co.uk.thehartford.life.security.passwordencoder.MigrateUsersPasswordEncoder' />
<security:authentication-manager>
<security:authentication-provider
user-service-ref="userDetailsService">
<security:password-encoder ref="bCryptPasswordEncoder" />
</security:authentication-provider>
</security:authentication-manager>
<bean id="userDetailsService" class="co.uk.thehartford.life.security.dao.ExtranetJdbcDaoImpl">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="customAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService" />
<property name="passwordEncoder" ref="bCryptPasswordEncoder" />
</bean>
我不知道是什么导致了这个错误。谁有想法?任何帮助是极大的赞赏。谢谢,如果需要任何进一步的信息,请告诉我,我会发布我可以发布的。
我还应该指出,我对 Spring 还很陌生,所以我可能会遗漏一些非常简单的东西。
【问题讨论】:
-
<200c><200b>让我想知道你的配置中是否有一些垃圾字符? -
我也想过,但是在 application-securityContext 中,类名后面没有空格,所以如果那里有垃圾字符或被插入,我不知道如何检查
-
您是否尝试删除并重写该特定行?
-
现在想起来,我只是复制粘贴,没有删改,我现在试试。
-
这正是holmis83的问题,感谢您的帮助!
标签: java spring spring-mvc spring-security