【问题标题】:Error occured processing XML 'Could not initialize class org.springframework.security.config.http.MatcherType'处理 XML 时发生错误“无法初始化类 org.springframework.security.config.http.MatcherType”
【发布时间】:2014-08-19 17:18:01
【问题描述】:

我正在使用 Spring 安全性和 Hibernate,但我在 xml 文件 spring-security.xml 中遇到以下问题

描述资源路径位置类型 处理 XML 时发生错误

Could not initialize class org.springframework.security.config.http.MatcherType'. See Error Log for more details    spring-security.xml /testholding/WebContent/WEB-INF line 9  Spring Beans Problem

问题是spring-security.xml的HTTP /HTTP

我需要帮助!

【问题讨论】:

标签: java xml spring-mvc primavera


【解决方案1】:

消息Could not initialize class SomeClass表示JVM已经尝试静态初始化类SomeClass失败。如果您重新启动 Web 应用程序容器并再次尝试重现错误,您可能会在第一次收到不同的消息。

类的静态初始化包括运行任何static { } 块并为任何static 字段分配值。对于你的错误信息中提到的MatcherType类,静态初始化如下:

private static final Log logger = LogFactory.getLog(MatcherType.class);

private static final String ATT_MATCHER_TYPE = "request-matcher";
private static final String ATT_PATH_TYPE = "path-type";

这两个字符串常量不会有问题。但是,第一个是我怀疑问题所在。方法 LogFactory.getLog 在 Apache Commons Logging 中。

因此,我敢打赌,您的 Web 应用程序缺少 commons-logging jar。尝试添加它,看看它是否会有所作为。

【讨论】:

    猜你喜欢
    • 2018-01-06
    • 1970-01-01
    • 2020-05-28
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多