私は、ローカルでうまく動作するplay 2.4 hibernate postgresqlアプリケーションを持っており、自動的にテーブルを自動的に作成します。しかし、herokuにデプロイされても、アプリケーションはエラーなしでロードされています(pgAdminからheroku dbを接続しました)が、テーブルを作成することはありません。マイ設定HibernateがHeroku postgresで自動的にスキーマを作成することができません
build.sbt
name := "lms"
version := "1.0"
lazy val `lms` = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(javaJdbc, cache, javaWs,
javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"),
"postgresql" % "postgresql" % "9.1-901-1.jdbc4",
"org.hibernate" % "hibernate-entitymanager" % "5.0.1.Final",
"net.sf.dozer" % "dozer" % "5.4.0")
unmanagedResourceDirectories in Test <+= baseDirectory(_/"target/web/public/test")
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"
application.conf
# 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 = "%APPLICATION_SECRET%"
# 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 `my.application.Router`,
# you may need to define a router file `conf/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.postgresql.Driver
db.default.url=${?DATABASE_URL}
db.default.jndiName = DefaultDS
jpa.default = defaultPersistenceUnit
db.default.hikaricp.connectionTestQuery="SELECT TRUE"
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/),
# by providing an application-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
db.default.logStatements = true
persistence.xmlの
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.show_sql" value="true"/>
<property name="javax.persistence.sql-load-script-source"
value="META-INF/sql/data.sql"/>
</properties>
</persistence-unit>
</persistence>
Procfile
web: target/universal/stage/bin/lms -Dhttp.port=${PORT} -Dplay.evolutions.db.default.autoApply=true -Ddb.default.url=${DATABASE_URL}
私はHerokuののpostgresの上で最初にデータベーススキーマを作成するためにしなければならない任意のより多くの変更がありますか?何が問題なの?
EDIT:
E:\Projects\lms\LMS>heroku buildpacks
=== leadmanagementsystem Buildpack URL
heroku/scala
E:\Projects\lms\LMS>heroku config
=== leadmanagementsystem Config Vars
DATABASE_URL: postgres://aaa:[email protected]:5432/dfregv
E:\Projects\lms\LMS>heroku run "echo $JDBC_DATABASE_URL"
Running echo $JDBC_DATABASE_URL on leadmanagementsystem... !
! ENOTFOUND: getaddrinfo ENOTFOUND api.heroku.com api.heroku.com:443
の例を参照してください。なぜ私はそれを使用した。また、herokuログのチェックでは、Herouku postgres dbは接続されていますが、テーブルは作成されません。 – silentprogrammer
'$ heroku buildpacks'の出力は何ですか? – codefinger
申し訳ありませんああ、窓にHerokuのは、「エコー$ JDBC_DATABASE_URL」 '' $ ' – codefinger