java NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15969139/
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
NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format
提问by quarks
I'm getting this error when running my application:
运行我的应用程序时出现此错误:
[ERROR] Apr 12, 2013 10:18:56 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
[ERROR] INFO: javax.servlet.ServletContext log: Initializing Shiro environment
[ERROR] 1601 [main] INFO org.apache.shiro.web.env.EnvironmentLoader - Starting Shiro environment initialization.
[ERROR] 1931 [main] INFO org.apache.shiro.config.IniSecurityManagerFactory - Realms have been explicitly set on the SecurityManager instance - auto-setting of realms will not occur.
[ERROR] 1984 [main] ERROR org.apache.shiro.web.env.EnvironmentLoader - Shiro environment initialization failed
[ERROR] java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
[ERROR] at org.slf4j.impl.SimpleLogger.formatAndLog(SimpleLogger.java:222)
[ERROR] at org.slf4j.impl.SimpleLogger.info(SimpleLogger.java:258)
[ERROR] at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:146)
[ERROR] at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
[ERROR] at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
[ERROR] at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
[ERROR] at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
[ERROR] at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
[ERROR] at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
[ERROR] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[ERROR] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[ERROR] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[ERROR] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[ERROR] at org.mortbay.jetty.Server.doStart(Server.java:224)
[ERROR] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[ERROR] at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:228)
[ERROR] at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:255)
[ERROR] at com.google.appengine.tools.development.AbstractServer.startup(AbstractServer.java:79)
[ERROR] at com.google.appengine.tools.development.DevAppServerImpl$Servers.startup(DevAppServerImpl.java:451)
[ERROR] at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:198)
[ERROR] at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
[ERROR] at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
[ERROR] at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
[ERROR] at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
[ERROR] at com.google.gwt.dev.DevMode.main(DevMode.java:311)
[ERROR] Apr 12, 2013 10:18:56 AM com.google.apphosting.utils.jetty.JettyLogger warn
This is the part of my pom.xml configuration which I think relates to this:
这是我的 pom.xml 配置的一部分,我认为与此相关:
<properties>
<!-- other properties omitted -->
<slf4jVersion>1.5.11</slf4jVersion>
</properties>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<!-- any library that uses commons-logging will be directed to slf4j -->
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<!-- any library that uses slf4j will be directed to java.util.logging -->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
</dependency>
I'm pretty sure I have the SLF4j version all setup into one version. What could be wrong in my configuration?
我很确定我将 SLF4j 版本全部设置为一个版本。我的配置可能有什么问题?
回答by Peter Knego
Use a newer version of slf4j, e.g. 1.7.5.
使用较新版本的 slf4j,例如 1.7.5。
回答by Greg L.
For anybody else that is being dogged by these errors I would also check if you are using: spring-ldap-test
对于被这些错误困扰的其他人,我还会检查您是否正在使用:spring-ldap-test
I inadvertently had this included in my runtime and it depends on apacheds-all-1.5.5.jar which has its own implementation of some slf4j classes. I wasted a lot of time trying to get around this before I added -verbose:class to my java command and saw that these classes were being loaded from that jar.
我无意中将它包含在我的运行时中,它依赖于 apacheds-all-1.5.5.jar,它有自己的一些 slf4j 类的实现。在我将 -verbose:class 添加到我的 java 命令并看到这些类是从那个 jar 加载之前,我浪费了很多时间试图解决这个问题。