播放框架2.2.1无法运行应用程序 - “页面不存在”

时间:2018-05-18 22:44:41

标签: java scala playframework

我尝试运行现有的播放应用程序,它编译并正确运行(在控制台中没有错误)。

但是当我打开主页(http://localhost:9000/)时:

显示

PAGE DOES NOT EXISTS消息。

我也在调试日志中找到了消息:

[application]-[ERROR] - [play-akka.actor.default-dispatcher-12] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18]

有人可以解释这条消息是什么意思吗?

另外很高兴知道,只应该play run用于项目启动或其他什么?

控制台输出:

--- (Running the application from SBT, auto-reloading is enabled) ---

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/MyProject/lib/logback_classic.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/play-2.2.1/repository/local/ch.qos.logback/logback-classic/1.0
.13/jars/logback-classic.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

[info] application - Cobrand details added into UserSession from ConfigurationFile
[info] application - Config loaded.
09:25:34,485 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:25:34,485 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:25:34,485 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml]
at [jar:file:/C:/play-2.2.1/repository/local/com.typesafe.play/play_2.10/2.2.1/jars/play_2.10.jar!/logback.xml]
09:25:34,485 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@1383357 - URL [jar:file:
/C:/play-2.2.1/repository/local/com.typesafe.play/play_2.10/2.2.1/jars/play_2.10.jar!/logback.xml] is not of type file
09:25:34,563 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:25:34,610 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.ConsoleAppender]
09:25:34,610 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]

09:25:34,626 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:25:34,641 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT
logger to ERROR
09:25:34,641 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named
 [STDOUT] to Logger[ROOT]
09:25:34,641 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:25:34,641 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@b29b88 - Registering current c
onfiguration as safe fallback point
09:25:34,657 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@1315e - URL [jar:file:/C
:/play-2.2.1/repository/local/com.typesafe.play/play_2.10/2.2.1/jars/play_2.10.jar!/logger.xml] is n
ot of type file
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversio
n word coloredLevel with class [play.api.Logger$ColoredLevel]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.FileAppender]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:25:34,657 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is set to [C:\MyProject/l
ogs/application.log]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.ConsoleAppender]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]

09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [play] to INFO
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [application] to DEBUG
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.avaje.ebean.config.PropertyMapLoader] to OFF
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.avaje.ebeaninternal.server.core.XmlConfigLoader] to OFF
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.avaje.ebeaninternal.server.lib.BackgroundThread] to OFF
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.gargoylesoftware.htmlunit.javascript] to OFF
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOTlogger to ERROR
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:25:34,657 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:25:34,657 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@501773 - Registering current c
onfiguration as safe fallback point
09:28:48,426 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:28:48,481 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversio
n word coloredLevel with class [play.api.Logger$ColoredLevel]
09:28:48,481 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.FileAppender]
09:28:48,481 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE_PLAY]
09:28:48,481 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:28:48,482 |-INFO in ch.qos.logback.core.FileAppender[FILE_PLAY] - File property is set to [C:\MyProject/logs/application.log]
09:28:48,482 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.ConsoleAppender]
09:28:48,482 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]

09:28:48,483 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@13:16 - no applicable action for [
pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]
09:28:48,483 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:28:48,484 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE_DEBUG]
09:28:48,486 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:28:48,495 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
09:28:48,496 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern C:/MyProject/lo
gs/debug_log.%d{yyyy-MM-dd_HH}.log for the active file
09:28:48,499 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date p
attern is 'yyyy-MM-dd_HH' from file name pattern 'C:/MyProject/logs/debug_log.%d{yyyy-MM-dd_HH}.log'.
09:28:48,499 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-overat the top of every hour.
09:28:48,501 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting in
itial period to Sat May 19 09:28:48 EEST 2018
09:28:48,502 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_DEBUG] - Active log file
 name: C:/MyProject/logs/debug_log.2018-05-19_09.log
09:28:48,502 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_DEBUG] - File property is set to [null]
09:28:48,502 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:28:48,502 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE_WARN]
09:28:48,503 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:28:48,504 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
09:28:48,504 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern C:/MyProject/lo
gs/warn_log.%d{yyyy-MM-dd}.log for the active file
09:28:48,504 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date p
attern is 'yyyy-MM-dd' from file name pattern 'C:/MyProject/logs/warn_log.%d{yyyy-MM-dd}.log'.
09:28:48,504 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-overat midnight.
09:28:48,504 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting in
itial period to Sat May 19 09:28:48 EEST 2018
09:28:48,504 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_WARN] - Active log file
name: C:/MyProject/logs/warn_log.2018-05-19.log
09:28:48,504 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_WARN] - File property is set to [null]
09:28:48,504 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:28:48,504 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE_ERROR]
09:28:48,504 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default t
ype [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:28:48,505 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
09:28:48,505 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern C:/MyProject/lo
gs/ERROR/error_log.%d{yyyy-MM-dd_HH}.log for the active file
09:28:48,506 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date p
attern is 'yyyy-MM-dd_HH' from file name pattern 'C:/MyProject/logs/ERROR/error_log.%d{yyyy-MM-dd_HH}.log'.
09:28:48,506 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over
at the top of every hour.
09:28:48,506 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting in
itial period to Sat May 19 09:28:48 EEST 2018
09:28:48,506 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_ERROR] - Active log file
 name: C:/MyProject/logs/ERROR/error_log.2018-05-19_09.log
09:28:48,506 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE_ERROR] - File property i
s set to [null]
09:28:48,506 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate append
er of type [ch.qos.logback.classic.db.DBAppender]
09:28:48,509 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [DB]
09:28:48,856 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@33aa43 - Driver name=MySQL-AB JDBC Driver
09:28:48,856 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@33aa43 - Driver version=
mysql-connector-java-5.1.18 ( Revision: tonci.grgin@oracle.com-20110930151701-jfj14ddfq48ifkfq )
09:28:48,856 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@33aa43 - supportsGetGeneratedKeys=true
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [application] to DEBUG
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [DB] to Logger[application]
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [application] to DEBUG
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE_DEBUG] to Logger[application]
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE_WARN] to Logger[application]
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE_ERROR] to Logger[application]
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [play] to INFO
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE_PLAY] to Logger[play]
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOTlogger to INFO
09:28:48,893 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:28:48,893 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@1ef40eb - Registering currentconfiguration as safe fallback point

警告日志文件输出:

2018-05-19 09:23:59,382 [application]-[ERROR] - [play-akka.actor.default-dispatcher-7] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18] 
2018-05-19 09:23:59,463 [application]-[ERROR] - [play-akka.actor.default-dispatcher-7] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18] 
2018-05-19 09:23:59,501 [application]-[WARN] - [play-akka.actor.default-dispatcher-7] - SessionElements:  Provider Exception null 
2018-05-19 09:23:59,555 [application]-[ERROR] - [play-akka.actor.default-dispatcher-7] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18] 
2018-05-19 09:23:59,596 [application]-[ERROR] - [play-akka.actor.default-dispatcher-7] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18] 
2018-05-19 09:25:01,634 [application]-[ERROR] - [play-akka.actor.default-dispatcher-9] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18] 
2018-05-19 09:25:01,755 [application]-[ERROR] - [play-akka.actor.default-dispatcher-9] - SessionElements: Brand Exception Unique expecting 0 or 1 rows but got [18]
  

问题在于应用程序配置,所以我刚刚将127.0.0.1:9000添加到数据库,所有工作都正确。对我来说很奇怪,如果localhost与数据库中的用户没有关联,那么显示错误页面。但有人写了它。   谢谢你的回复!

1 个答案:

答案 0 :(得分:0)

它也可能与您项目的cookie会话有关,请查看application.conf并查看cookies session / flash配置,数据库配置等。

回答您的其他问题,有时您需要传递其他特定配置文件,如

run -Dconfig.resources = otherconfigfilename.conf或应用程序密钥,如

run -Dplay.http.secret.key="fnglksjgajadljglaj"

但是对于更简单的项目,sbt run可以解决问题