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文件夹下

java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory的更多相关文章

  1. java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from 解决

    在用spark的yarn-cluster模式跑fpgrowth进行频繁项集挖掘的时候,报如下错误: ERROR yarn.ApplicationMaster: User class threw exc ...

  2. java.lang.IllegalAccessError: tried to access method

    java.lang.IllegalAccessException: access to method denied 06-23 16:12:39.128 1253-1253/com.hbjyjt.oa ...

  3. java.lang.IllegalAccessError: tried to access method org.apache.poi.util.POILogger.log from class org.apache.poi.openxml4j.opc.ZipPackage

    代码说简单也简单,说复杂那还真是寸步难行. 之前好好的excel导出功能,本地启动调试的时候突然就不行了,一直报上面的错. 一直在本地折腾了半天,去测试环境上看,又是好的,可以正常导出excel. 搜 ...

  4. java.lang.IllegalAccessError: org.apache.commons.dbcp.DelegatingPreparedStatement.isClosed()Z

    做spring和mybaits整合时出现的错误,让这个问题困扰了一早上,通过查资料终于把这个问题解决了 具体问题描述: java.lang.IllegalAccessError: org.apache ...

  5. Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

    Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implem ...

  6. java.lang.SecurityException: Can't make field constructor accessible

    原本使用GsonConvertor,在Android版本5.1.1上没有任何问题,结果切换到版本6.0.1上,出现以下所示问题: java.lang.IllegalArgumentException: ...

  7. Error during generated code invocation: com.intellij.debugger.engine.evaluation.EvaluateException: Method threw 'java.lang.IllegalAccessError' exception.

    场景描述: 再从该数据库中读取数据进行处理的时候,需要将某个字段加入到一个动态的map中,然后需要对该map进行filter过滤,在执行过滤方法的时候报错 Error during generated ...

  8. 【转】Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

    Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implem ...

  9. Atitit. 。Jna技术与 解决 java.lang.Error: Invalid memory access

    Atitit. .Jna技术与 解决 java.lang.Error: Invalid memory access 1. 原因与解决1 2. jNA (这个ms sun 的)1 3. Code1 4. ...

随机推荐

  1. overflow的几个坑

    在android 4.0的原生浏览器上注意: html元素上不要加overflow: auto;的样式,否则会造成有些元素无法点击 在absolute元素上 不要加 overflow: auto; 否 ...

  2. hdoj 2121 Ice_cream’s world II 【没有最低树的根节点】

    称号:pid=2121" target="_blank">hdoj 2121 Ice_cream's world II 题意:题目是一道躶题,给n个点,m条边的有向 ...

  3. inner join on, left join on, right join on

    1.定义: inner join(等值连接) : 仅仅返回两个表中联结字段相等的记录 left join(左联接) :返回包含左表中的全部记录和右表中联结字段相等的记录 right join(右联接) ...

  4. Java操作memcached(一)

    Memcached事实上,两次Hash算法    第一次hash算法被用于定位Memcached示例    第二次hash算法是底部HashMap中间hash算法 Hash算法      1.依据余数 ...

  5. Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite数据库时Provider问题

    传送门 什么是CodeFristFromDB 问题:查询数据是遇到 “/”应用程序中的服务器错误. No Entity Framework provider found for the ADO.NET ...

  6. Struts2 + uploadify 多文件上传完整的例子!

    首先,我这里使用的是  Jquery  Uploadify3.2版本号  导入相关的CSS  JS    <link rel="stylesheet" type=" ...

  7. Android 让他们自己控制开发的定义(一个)

    作为一个创意开发.或软件UI设计要求比较高,你经常会遇到的情况来圣安德鲁斯控制不符合您的需求.这样的时候.件.同一时候.安卓也同意你去继承已经存在的控件或者实现你自己的控件以便优化界面和创造更加丰富的 ...

  8. HTTP工作原理

     HTTP工作过程 HTTP协议定义Webclient怎样从Webserver请求Web页面,以及server怎样把Web页面传送给client.HTTP协议採用了请求/响应模型. client向 ...

  9. android 防止多次点击提交

    版权声明:本文博客原创文章.博客,未经同意,不得转载.

  10. CPU 风扇清理灰尘加油全过程图解

    主机电源风扇因为使用时间长,风扇轴承的润滑油耗尽,导致风扇转速下降或是不转,引起电源热量无法有效排除而造成电脑常常死机,解决的方法有几种. 现图讲解明最简单省钱的办法例如以下: 1.把电源从主机上拆下 ...