我创建了一个grails 3应用程序并配置了以下生产环境:
environments {
production {
dataSource {
dbCreate = "update"
driverClassName = "org.postgresql.Driver"
dialect= CustomPostgresDialect
uri = new URI(System.getenv("OPENSHIFT_POSTGRESQL_DB_URL"))
url = "jdbc:postgresql://" + uri.host + ":" + uri.port + "/" + System.getenv("OPENSHIFT_APP_NAME")
username = System.getenv("OPENSHIFT_POSTGRESQL_DB_USERNAME")
password = System.getenv("OPENSHIFT_POSTGRESQL_DB_PASSWORD")
}
}
}
我按照以下步骤操作:https://blog.openshift.com/day-6-rapid-web-development-on-the-jvm-with-grails/
但是当我尝试访问应用网址时,我会收到404。
我无法从日志中找出问题:
In app-root/logs/postgresql.log
2016-06-20 12:16:20 GMT LOG: database system is shut down
2016-06-20 12:16:29 GMT LOG: could not bind socket for statistics collector: Permission denied
2016-06-20 12:16:29 GMT LOG: trying another address for the statistics collector
2016-06-20 12:16:29 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2016-06-20 12:16:29 GMT LOG: disabling statistics collector for lack of working socket
2016-06-20 12:16:29 GMT WARNING: autovacuum not started because of misconfiguration
2016-06-20 12:16:29 GMT HINT: Enable the "track_counts" option.
2016-06-20 12:16:29 GMT LOG: database system was shut down at 2016-06-20 12:16:20 GMT
2016-06-20 12:16:29 GMT FATAL: the database system is starting up
2016-06-20 12:16:29 GMT LOG: database system is ready to accept connections
In app-root/logs/jbossews.log
Jun 20, 2016 8:16:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Jun 20, 2016 8:16:36 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/5767c8e30c1e6699f90000eb/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
Jun 20, 2016 8:17:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/5767c8e30c1e6699f90000eb/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 29,596 ms
Jun 20, 2016 8:17:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.12.216.1-8080"]
Jun 20, 2016 8:17:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 29969 ms
我缺少什么?
答案 0 :(得分:2)
错误在于弹簧安全性的设置。默认情况下,spring security会重定向到我不支持的URL。
通过查看文档,我发现该设置可以覆盖如下:
grails.plugin.springsecurity.auth.loginFormUrl =' / api / login'
如果未指定,则spring security将使用默认值:/ login / auth