java项目中的异常[java.lang.IllegalAccessError:试图访问字段org.slf4j.impl.StaticLoggerBinder.SINGLETON]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20088650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Exception in java project [java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON]
提问by user3008626
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
at com.erp.utility.Hibernatesession.getSession(Hibernatesession.java:24)
at com.erp.dao.Country_Dao.getcountryByname(Country_Dao.java:88)
at com.erp.service.Country_Service.getcountryByname(Country_Service.java:36)
at com.erp.storedata.Store_Data.main(Store_Data.java:24)
回答by Yubaraj
Please add following file on your project:
请在您的项目中添加以下文件:
slf4j-log4j12.jar
回答by LConrad
Use a newer version of the slf4j-api.jar. There was a breaking change between version 1.5.5 and earlier and 1.5.6 and later. Use a version after 1.5.6, and that error should go away. For reference, see http://www.slf4j.org/faq.html#IllegalAccessError.
使用较新版本的 slf4j-api.jar。1.5.5 及更早版本与 1.5.6 及更高版本之间发生了重大变化。使用 1.5.6 之后的版本,该错误应该会消失。如需参考,请参阅http://www.slf4j.org/faq.html#IllegalAccessError。
回答by SWAPNIL KUWAR
remove the file slf4j-api.jar from your build path.
从构建路径中删除文件 slf4j-api.jar。