`
Josh_Persistence
  • 浏览: 1653563 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类

...Tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON...

阅读更多

在做Hiernate4和Spring3的集成时,发现如下的Exception: 

 

Caused by: 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 net.sf.ehcache.config.ConfigurationFactory.<clinit>(ConfigurationFactory.java:51)
	at org.hibernate.cache.ehcache.internal.util.HibernateUtil.loadAndCorrectConfiguration(HibernateUtil.java:63)
	at org.hibernate.cache.ehcache.EhCacheRegionFactory.start(EhCacheRegionFactory.java:93)
	at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:70)
	at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40)
	at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35)
	at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:264)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1861)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
	... 22 more

 

 

这个问题的出现是由于slf4j-log4j12 jar的变化,从1.5.6版本后,slf4j-log4j12 jar不再允许访问org.slf4j.impl.StaticLoggerBinder.SINGLETON.

 

有2中解决方案:

1. 去掉项目中的所有低版本的slf4j-api.jar ,slf4j-log4j12.jar. (低于1.5.6版本)

 

2. 如果确实需要使用slf4j-api.jar,则使用1.5.6以上版本的slf4j-api.jar和slf4j-log4j12.jar

 

<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.5.6</version>

 

<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.5.6</version></dependency>

 

0
4
分享到:
评论

相关推荐

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

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

    Retrying connect to server 0.0.0.08032异常.md

    向yarn提交任务时Retrying connect to server 0.0.0.0:8032异常

    oaid_sdk_1.2.1资源包及说明

    java.lang.UnsatisfiedLinkError: No implementation found for int com.bun.miitmdid.e.a() (tried Java_com_bun_miitmdid_e_a and Java_com_bun_miitmdid_e_a__) 下面这个异常,多半是由于没有调用System....

    Unit_6_An_old_man_tried_to_move_the_mountains.教学设计.docx

    "Unit 6 An old man tried to move the mountains.教学设计" 本教学设计旨在帮助八年级学生学习英语,具体来说是学习Unit 6 An old man tried to move the mountains.该单元的中心话题是“传奇式的童话故事”,语言...

    Introduction.To.Algorithms,.Second.Edition

    have tried, however, to make this a book that will be useful to you now as a course textbook and also later in your career as a mathematical desk reference or an engineering handbook. What are the ...

    Android九宫格手势密码解锁控件源码及其资源

    4. **状态管理**:解锁控件需要维护多个状态,如未解锁、解锁成功、解锁失败等,这些状态需要通过改变视图的显示方式(如颜色变化、动画效果等)来反馈给用户。 5. **持久化数据**:为了保存用户的解锁设置,需要将...

    Introduction to Probability, 2nd Edition -Athena Scientific

    Accordingly, we have tried to strike a balance between simplicity in exposition and sophistication in analytical reasoning. Our key aim has been to develop the ability to construct and analyze ...

    Unity.5.From.Zero.to.Proficiency.B01EJCE85M

    Unity 5 From Zero to Proficiency (Intermediate): A step-by-step guide to coding your first game in C# with Unity. Why this book can help you to get started with Game Development Creating your own ...

    Spark in Action.pdf

    We’ve tried to describe all aspects of using Spark: from configuring runtime options and running standalone and interactive jobs, to writing batch, streaming, or machine learning applications. And ...

    Que.Absolute.Beginners.Guide.to.Project.Management.Apr.2005.chm

    Through topics such as "building a project budget and schedule" to "managing vendors," this book will guide you through what works and what doesn't based on tried and true practices. Your learning ...

    cisco_ios_access_lists.pdf

    Chapter 4, describes using access lists to control routing. Network administrators typically use access lists for routing to make sure that their networks are robust and to implement business policy...

    解决出现CUDA error-out of memory的问题.pdf

    4. **动态批大小**:根据GPU的可用显存动态调整批量大小,例如使用`torch.cuda.memory_allocated()`和`torch.cuda.memory_cached()`来监测显存使用情况。 5. **数据预处理**:对输入数据进行预处理,如压缩、归一化...

    (最终解决)java.lang.UnsatisfiedLinkError解决尝试

    Java中的`java.lang.UnsatisfiedLinkError`是一个常见的运行时异常,通常出现在Java试图加载本地(C或C++)库但找不到相应的库文件时。这个错误可能是由于多种原因引起的,如库路径设置不正确、库文件不存在或者版本...

    java python SM3 加密算法,及开发包。。等bcprov-jdk16-1.46 SM3.java SM3

    java SM3 加密算法,及开发货。。python 等 bcprov-jdk16-1.46 SM3.java SM3Digest.java SM3Utils.java Util.java解压可用!

    I have tried to develop a very good browser. Now I myself ca

    I have tried to develop a very good browser. Now I myself can’t rate it... so i am leaving to you guys out there to rate it..

    Design.Patterns.Explained.Simply

    We've tried hard to avoid both of these categories with Design Patterns Explained Simply. This book is fast and simple way to get the idea behind each of the 29 popular design patterns. The book is ...

    C++XML文件解析库tinyxml

    I've also tried to include some C++ tips like how to convert strings to integers and vice versa. This isn't anything to do with TinyXML itself, but it may helpful for your project so I've put it in ...

    protobuf-dt com.google.eclipse.protobuf_2.3.2.201609161849.jar

    I did not manage to set/override the Options definition file either (I tried with and without a 'file:///' prefix). Is this supposed to be a file within the project? It is also not clear when changing...

    别踩白块游戏源码

    4. **动画与效果**:《别踩白块》中,方块的移动、消失和得分显示都涉及到动画效果。源码中会用到OGEngine提供的动画框架,通过帧动画或者平移、缩放等变换来实现视觉效果。 5. **音效处理**:游戏中的每个方块点击...

Global site tag (gtag.js) - Google Analytics