0

我使用 play dist 创建了一个独立的 java 服务器。它使用以下配置文件:

# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="mysecretkey"
application.baseUrl="myurl"
application.mode=prod
# The application languages
# ~~~~~
application.langs="en"

# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global

# Router 
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point. 
# Furthermore, it's assumed your route file is named properly. 
# So for an application router like `conf/my.application.Router`,
# you may need to define a router file `my.application.routes`.
# Default to Routes in the root package (and `conf/routes`)
# application.router=my.application.Routes

# Database configuration
# ~~~~~ 
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
# db.default.jndiName=DefaultDS

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled

# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named `default`
#
# ebean.default="models.*"

# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG
http.port=80

出于某种原因,它忽略了整个配置文件。它仍然认为 baseUrl 是项目名称,并且绑定到端口 9000。我做错了什么?下面是最终在服务器上运行的。

java -cp ./lib/org.scala-lang.scala-library-2.10.0.jar:./lib/play.play_2.10-2.1.0.jar:./lib/play.sbt-link-2.1 .0.jar:./lib/org.javassist.javassist-3.16.1-GA.jar:./lib/play.play-exceptions-2.1.0.jar:./lib/play.templates_2.10-2.1 .0.jar:./lib/com.github.scala-incubator.io.scala-io-file_2.10-0.4.2.jar:./lib/com.github.scala-incubator.io.scala-io -core_2.10-0.4.2.jar:./lib/com.jsuereth.scala-arm_2.10-1.3.jar:./lib/play.play-iteratees_2.10-2.1.0.jar:./lib /org.scala-stm.scala-stm_2.10.0-0.6.jar:./lib/com.typesafe.config-1.0.0.jar:./lib/io.netty.netty-3.5.9.Final.jar :./lib/org.slf4j.jul-to-slf4j-1.6.6.jar:./lib/org.slf4j.jcl-over-slf4j-1.6.6.jar:./lib/ch.qos.logback .logback-core-1.0.7.jar:./lib/ch.qos.logback.logback-classic-1.0.7.jar:./lib/com.typesafe.akka.akka-actor_2.10-2.1.0 .jar:./lib/com.typesafe.akka.akka-slf4j_2.10-2.1.0.jar:./lib/org.slf4j。slf4j-api-1.7.2.jar:./lib/joda-time.joda-time-2.1.jar:./lib/org.joda.joda-convert-1.2.jar:./lib/org.apache。 commons.commons-lang3-3.1.jar:./lib/com.ning.async-http-client-1.7.6.jar:./lib/oauth.signpost.signpost-core-1.2.1.2.jar:./ lib/commons-codec.commons-codec-1.3.jar:./lib/oauth.signpost.signpost-commonshttp4-1.2.1.2.jar:./lib/org.apache.httpcomponents.httpcore-4.0.1.jar: ./lib/org.apache.httpcomponents.httpclient-4.0.1.jar:./lib/commons-logging.commons-logging-1.1.1.jar:./lib/org.codehaus.jackson.jackson-core- asl-1.9.10.jar:./lib/org.codehaus.jackson.jackson-mapper-asl-1.9.10.jar:./lib/net.sf.ehcache.ehcache-core-2.6.0.jar: ./lib/javax.transaction.jta-1.1.jar:./lib/org.scala-lang.scala-reflect-2.10.0.jar:./lib/play.play-java_2.10-2.1.0。 jar:./lib/org.yaml.snakeyaml-1.10.jar:./lib/org.hibernate.hibernate-validator-4.3.0.Final.jar:./lib/javax。validation.validation-api-1.0.0.GA.jar:./lib/org.jboss.logging.jboss-logging-3.1.0.CR2.jar:./lib/org.springframework.spring-context-3.1。 2.RELEASE.jar:./lib/org.springframework.spring-core-3.1.2.RELEASE.jar:./lib/org.springframework.spring-beans-3.1.2.RELEASE.jar:./lib/ org.reflections.reflections-0.9.8.jar:./lib/com.google.guava.guava-13.0.1.jar:./lib/com.google.code.findbugs.jsr305-2.0.1.jar: ./lib/javax.servlet.javax.servlet-api-3.0.1.jar:./lib/play.play-java-jdbc_2.10-2.1.0.jar:./lib/play.play-jdbc_2。 10-2.1.0.jar:./lib/com.jolbox.bonecp-0.7.1.RELEASE.jar:./lib/com.h2database.h2-1.3.168.jar:./lib/tyrex.tyrex- 1.0.1.jar:./lib/play.play-java-ebean_2.10-2.1.0.jar:./lib/org.avaje.ebeanorm.avaje-ebeanorm-3.1.2.jar:./lib/ org.avaje.ebeanorm.avaje-ebeanorm-api-3.1.1.jar:./lib/org.avaje.ebeanorm.avaje-ebeanorm-agent-3.1.1.jar:./lib/org.avaje.ebeanorm。avaje-ebeanorm-server-3.1.2.jar:./lib/org.hibernate.javax.persistence.hibernate-jpa-2.0-api-1.0.1.Final.jar:./lib/huntress_2.10-0.1- SNAPSHOT.jar -Dconfig.file=./application.prod.conf play.core.server.NettyServer 。

编辑:我知道它正在加载文件。如果文件中有错误,例如 url 中的冒号没有被引号包围,它会吐出错误并停止运行。

4

1 回答 1

1

http.port东西仅适用于播放框架1.x。要在不同于 9000 的端口上运行您的应用程序,您应该像这样启动应用程序:( play "run 80"play "start 80"

还要考虑您必须具有 sudo 权限才能在端口 <1024 上运行应用程序

编辑:至于start脚本,您应该http.port在运行脚本时添加参数:bash start -Dhttp.port=80

于 2013-09-09T06:26:30.890 回答