CAS server启动错误:java.lang.ClassNotFoundException: org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler

错误内容

在配置 CAS 4.2.1 进行自定义的数据源(Mysql)验证配置时,出现如下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'centralAuthenticationService' defined in ServletContext resource [/WEB-INF/spring-configuration/applicationContext.xml]: Cannot resolve reference to bean 'authenticationManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager' defined in ServletContext resource [/WEB-INF/deployerConfigContext.xml]: Cannot resolve reference to bean 'dbAuthHandler' while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler] for bean with name 'dbAuthHandler' defined in ServletContext resource [/WEB-INF/deployerConfigContext.xml]; nested exception is java.lang.ClassNotFoundException: org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:326)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
    at ....

解决方案

这是因为缺少数据连接包所导致的, 需要添加相关jar包(可以到Maven中央仓库寻找对应的jar)到 tomcat目录\webapps\cas应用\WEB-INF\lib 下:

  1. cas-server-support-jdbc-4.2.1.jar

编译项目后,可以在 cas-4.2.1\cas-server-support-jdbc\build\libs\cas-server-support-jdbc-4.2.1.jar 找到

  1. mysql-connector-java-5.1.21.jar

mysql驱动

  1. c3p0-0.9.1.2

非必要,一般已存在

你可能感兴趣的:(CAS server启动错误:java.lang.ClassNotFoundException: org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler)