简体   繁体   中英

logger() slf4j error: The method logger() from the type CoreLogger refers to the missing type Logger

I am using slf4j imports and i have the following code:

do {
            if (error) {
                logger().error("Known issue: clicking [" + item + "] had no effect. Retrying...");
            }
            logger().info("Clicking the [" + item + "] menu item...");
            element.click();
            er`

However Eclipse is throwing me the following compilation error: The method logger() from the type CoreLogger refers to the missing type Logger . I have all the imports done right, and the same code runs just fine for the person next to me. Do you have any insights into this?

The method logger() from the type CoreLogger refers to the missing type Logger.

It is not a missing import of the class but a class not retrieved at compile time. Are you sure that the slf4j jar is in the classpath of your project ?
If it is the case, it is probably a IDE issue : you can identify it by compiling your project outside the IDE (so in command line).
If it doesn't work : you have not the dependency at compile time.
If it works : you should look for a solution in your IDE (clean and refresh the project configuration for example)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM