我只是在我的 mac 上试用 play framework 2.0。我已经使用 Play 1.x 一段时间了,没有任何问题。我已经下载了新框架,更新了我的 PATH 以指向新版本的 play 并创建了一个简单的 Java 项目('play new testapp')
当我调用 play run 时,出现以下错误:
log4j:WARN No appenders could be found for logger (akka.event.slf4j.Slf4jEventHandler).
log4j:WARN Please initialize the log4j system properly.
[error] java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
[error] Use 'last' for the full log.
根据上面的错误,我运行了“last”命令,下面是由此产生的堆栈跟踪的摘录:
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:203)
at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:278)
at java.util.logging.Logger.log(Logger.java:478)
at java.util.logging.Logger.doLog(Logger.java:500)
at java.util.logging.Logger.logp(Logger.java:616)
at org.jboss.netty.logging.JdkLogger.debug(JdkLogger.java:36)
at org.jboss.netty.logging.InternalLoggerFactory$1.debug(InternalLoggerFactory.java:80)
at org.jboss.netty.channel.socket.nio.NioProviderMetadata.<clinit>(NioProviderMetadata.java:95)
at org.jboss.netty.channel.socket.nio.NioWorker.<clinit>(NioWorker.java:58)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.<init>(NioServerSocketPipelineSink.java:58)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:133)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:104)
at play.core.server.NettyServer.<init>(NettyServer.scala:43)
我启动了一个 Ubuntu VM 并完成了相同的过程,应用程序运行良好。有什么建议么?
编辑:我运行 play classpath 来获取应用程序的类路径,这是输出(将目录的公共部分替换为 ...):
Here is the computed classpath of your application:
- .../testapp/target/scala-2.9.1/classes
- ...play-latest/framework/sbt/boot/scala-2.9.1/lib/scala-library.jar
- ...play-latest/framework/../repository/local/play/play_2.9.1/2.0/jars/play_2.9.1.jar
- ...play-latest/framework/../repository/local/play/templates_2.9.1/2.0/jars/templates_2.9.1.jar
- ...play-latest/repository/local/com.github.scala-incubator.io/scala-io-file_2.9.1/0.2.0/jars/scala-io-file_2.9.1.jar
- ...play-latest/repository/local/com.github.scala-incubator.io/scala-io-core_2.9.1/0.2.0/jars/scala-io-core_2.9.1.jar
- ...play-latest/repository/local/com.github.jsuereth.scala-arm/scala-arm_2.9.1/0.3/jars/scala-arm_2.9.1.jar
- ...play-latest/framework/../repository/local/play/anorm_2.9.1/2.0/jars/anorm_2.9.1.jar
- ...play-latest/framework/../repository/local/io.netty/netty/3.3.0.Final/bundles/netty.jar
- ...play-latest/framework/../repository/local/org.slf4j/slf4j-api/1.6.4/jars/slf4j-api.jar
- ...play-latest/framework/../repository/local/org.slf4j/jul-to-slf4j/1.6.4/jars/jul-to-slf4j.jar
- ...play-latest/framework/../repository/local/org.slf4j/jcl-over-slf4j/1.6.4/jars/jcl-over-slf4j.jar
- ...play-latest/framework/../repository/local/ch.qos.logback/logback-core/1.0.0/jars/logback-core.jar
- ...play-latest/framework/../repository/local/ch.qos.logback/logback-classic/1.0.0/jars/logback-classic.jar
- ...play-latest/framework/../repository/local/com.typesafe.akka/akka-actor/2.0/jars/akka-actor.jar
- ...play-latest/framework/../repository/local/com.typesafe.akka/akka-slf4j/2.0/jars/akka-slf4j.jar
- ...play-latest/framework/../repository/local/com.google.guava/guava/10.0.1/jars/guava.jar
- ...play-latest/framework/../repository/local/com.google.code.findbugs/jsr305/1.3.9/jars/jsr305.jar
- ...play-latest/framework/../repository/local/org.avaje/ebean/2.7.3/jars/ebean.jar
- ...play-latest/framework/../repository/local/org.hibernate.javax.persistence/hibernate-jpa-2.0-api/1.0.1.Final/jars/hibernate-jpa-2.0-api.jar
- ...play-latest/framework/../repository/local/com.h2database/h2/1.3.158/jars/h2.jar
- ...play-latest/framework/../repository/local/org.scala-tools/scala-stm_2.9.1/0.4/jars/scala-stm_2.9.1.jar
- ...play-latest/framework/../repository/local/com.jolbox/bonecp/0.7.1.RELEASE/bundles/bonecp.jar
- ...play-latest/framework/../repository/local/org.yaml/snakeyaml/1.9/bundles/snakeyaml.jar
- ...play-latest/framework/../repository/local/org.hibernate/hibernate-validator/4.2.0.Final/jars/hibernate-validator.jar
- ...play-latest/framework/../repository/local/javax.validation/validation-api/1.0.0.GA/jars/validation-api.jar
- ...play-latest/framework/../repository/local/org.springframework/spring-context/3.0.7.RELEASE/jars/spring-context.jar
- ...play-latest/framework/../repository/local/org.springframework/spring-core/3.0.7.RELEASE/jars/spring-core.jar
- ...play-latest/framework/../repository/local/org.springframework/spring-beans/3.0.7.RELEASE/jars/spring-beans.jar
- ...play-latest/framework/../repository/local/joda-time/joda-time/2.0/jars/joda-time.jar
- ...play-latest/framework/../repository/local/org.joda/joda-convert/1.1/jars/joda-convert.jar
- ...play-latest/framework/../repository/local/javassist/javassist/3.12.1.GA/jars/javassist.jar
- ...play-latest/framework/../repository/local/commons-lang/commons-lang/2.6/jars/commons-lang.jar
- ...play-latest/framework/../repository/local/com.ning/async-http-client/1.7.0/jars/async-http-client.jar
- ...play-latest/framework/../repository/local/oauth.signpost/signpost-core/1.2.1.1/jars/signpost-core.jar
- ...play-latest/framework/../repository/local/commons-codec/commons-codec/1.3/jars/commons-codec.jar
- ...play-latest/framework/../repository/local/com.codahale/jerkson_2.9.1/0.5.0/jars/jerkson_2.9.1.jar
- ...play-latest/framework/../repository/local/org.codehaus.jackson/jackson-core-asl/1.9.5/jars/jackson-core-asl.jar
- ...play-latest/framework/../repository/local/org.codehaus.jackson/jackson-mapper-asl/1.9.5/jars/jackson-mapper-asl.jar
- ...play-latest/framework/../repository/local/org.reflections/reflections/0.9.6/jars/reflections.jar
- ...play-latest/framework/../repository/local/javax.servlet/javax.servlet-api/3.0.1/jars/javax.servlet-api.jar
- ...play-latest/framework/../repository/local/javax.transaction/jta/1.1/jars/jta.jar
- ...play-latest/framework/../repository/local/tyrex/tyrex/1.0.1/jars/tyrex.jar
- ...play-latest/framework/../repository/local/jaxen/jaxen/1.1.3/jars/jaxen.jar
- ...play-latest/framework/../repository/local/net.sf.ehcache/ehcache-core/2.5.0/jars/ehcache-core.jar