Java. Lang. illegalaccesserror: tried to access field org. slf4j. impl. staticloggerbinder. Singleton from

Source: Internet
Author: User

Java. Lang. illegalaccesserror: tried to access field org. slf4j. impl. staticloggerbinder. Singleton from class org. slf4j. loggerfactory

When using hbm2java, using the hibernate-distribution-3.3.1.GA-dist version, after the program and configuration file is completed, the running program appears exception in thread "Main"Java. Lang. illegalaccesserror: tried to access field org. slf4j. impl. staticloggerbinder. Singleton from class org. slf4j. loggerfactoryError.

Cause: JAR file version conflict

Class org. slf4j. impl. staticloggerbinder is the public static variable of the class in the slf4j-api:

Public static final staticloggerbinder Singleton = new staticloggerbinder ();


And in slf4j-log4j12 (slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or one of the logback-classic.jar) is indeed a private variable:

Private Static final staticloggerbinder Singleton = new staticloggerbinder ();

Solution: 1. Modify the SLF source code, change the variable private to public, and then package it. The problem can be solved.

2. Remove the slf4j-api.jar and then import the slf4j-api-1.5.6.jar and slf4j-log4j12-1.5.6.jar of the same version. The problem can be solved.

 

The slf4j-api.jar is in the hibernate-distribution-3.3.1.GA-dist/lib/required folder

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.