`

java.lang.IllegalAccessError: tried to access field org.slf4j.impl.Static..[转]

阅读更多
java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory

使用hbm2java时,使用hibernate-distribution-3.3.1.GA-dist版本,做好了程序和配置文件后,运行程序出现Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory错误。



问题原因:jar文件版本冲突

类 org.slf4j.impl.StaticLoggerBinder在slf4j-api 中是类的公有静态变量:




public static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();


而在slf4j-log4j12(slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar其中之一)中确是私有变量:



private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();



解决方案:1.修改slf的源代码,将这个变量有私有改为公有,再打包,问题可解决。

                  2.slf4j-api.jar 删除,再导入同版本的slf4j-api-1.5.6.jar 和slf4j-log4j12-1.5.6.jar ,问题可解决。

slf4j-api.jar 在hibernate-distribution-3.3.1.GA-dist/lib/required文件夹下


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/rommal7090/archive/2009/04/01/4041240.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/rommal7090/archive/2009/04/01/4041240.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/rommal7090/archive/2009/04/01/4041240.aspx

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/rommal7090/archive/2009/04/01/4041240.aspx
分享到:
评论

相关推荐

    在应用中集成AXMLPrinter,从apk文件中提取包名,版本等信息

    如果在安卓工程中,直接使用AXMLPrinter的jar,会报错java.lang.IllegalAccessError: tried to access class android.content.res.StringBlock from class android.content.res.AXmlResourceParser 这需要修改里面...

    java 异常总结

    java.lang.IllegalAccessError 违法访问错误。当一个应用试图访问、修改某个类的域(Field)或者调用其方法,但是又违反域或方法的可见性声明,则抛出该异常。 java.lang.IncompatibleClassChangeError 不兼容的类...

    黑白棋C#代码

    是个黑白棋的人工智能源码,本人编写以供参考

    websphere上发布基于jndi的应用

    NULL 博文链接:https://chenhua-1984.iteye.com/blog/1543415

    mavenexample

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project broken: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac...

    低版本TBS_SDK.zip

    针对高版本TBS初始化失败问题使用低版本SDK可以解决

    custom-tabs-client:Chrome自定义标签示例

    不推荐使用 该存储库已弃用。 请改用或 。 您可以通过阅读了解有关弃用的更多信息,以及应该使用哪个库... java.lang.IllegalAccessError: Method 'android.os.Bundle android.support.customtabs.CustomTabColorSch

    tact:Tact 自动向类文件中的 Java 字节码添加某些运行时检查

    机智 Tact 是一个 Java 程序和包,用于将运行时检查插入到 Java 字节码中。 这些检查的目标是通过确保只有预期线程访问任何对象(通过单独所有权或持有适当的锁)来帮助多线程程序的开发。例子运行 tact 最方便的...

Global site tag (gtag.js) - Google Analytics