Eclipse调试cas server 3.5.2.1

由于在配置CAS+LDAP总是报错,决定Eclipse调试cas server,跟踪问题出在哪里?

=============================================================
WHO: [username: aaaa]
WHAT: 'principal' cannot be null.
Check the correctness of @Audit annotation at the following audit point: execution(public abstract org.jasig.cas.authentication.Authentication org.jasig.cas.authentication.AuthenticationManager.authenticate(org.jasig.cas.authentication.principal.Credentials))
ACTION: TICKET_GRANTING_TICKET_NOT_CREATED
APPLICATION: CAS
WHEN: Thu May 29 17:04:41 CST 2014
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================


这里以cas-server-3.5.2.1-release.zip说明如何配置调试环境:
1. 下载cas-server-3.5.2.1-release.zip,这里面包含了源码和打包后的文件。
2. 解压缩cas-server-3.5.2.1-release.zip,在modules子目录里面找到cas-server-webapp-3.5.2.1.war。
3. 解压缩cas-server-webapp-3.5.2.1.war到eclipse的workspace目录,这样可以让cas-server-webapp-3.5.2.1方便成为eclipse的一个项目。
4. 在cas-server-webapp-3.5.2.1下新建WebContent子目录。WebContent是eclipse web项目的网站根目录。
5. 将原来cas-server-webapp-3.5.2.1目录下的所有内容都移动到WebContent。
6. 删除WebContent/WEB-INF/classes目录下的org目录。这个目录对应的是cas-server-webapp的源码。
7. 将cas-server-3.5.2.1-releas/cas-server-core/src/main/java目录下的源码复制到cas-server-webapp-3.5.2.1/cas-server-core。只需要java目录就可以,其它都不要。
8. 重复第7步,将cas-server-webapp和cas-server-support-ldap目录下的源码都复制过来。最后的目录结构如下图:

9. 编译cas-server-support-ldap时需要用到spring-ldap-core和spring-ldap-core-tiger,注意要1.3.2的版本,不要用最新的2.0.2的版本。这两个文件不容易找到,可以用maven去自动下载。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-app</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
        <groupId>org.springframework.ldap</groupId>
        <artifactId>spring-ldap-core</artifactId>
        <version>1.3.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.ldap</groupId>
        <artifactId>spring-ldap-core-tiger</artifactId>
        <version>1.3.2.RELEASE</version>
    </dependency>
  </dependencies>
</project>

10. 创建Dyanmic Web Project,注意源码目录的定义,不是默认的src。


11. 配置完毕,可以调试了。


原文地址:https://www.cnblogs.com/eastson/p/3761441.html