gpt4 book ai didi

mysql - Grails 中的 Cloud Foundry v2

转载 作者:行者123 更新时间:2023-11-29 23:41:15 27 4
gpt4 key购买 nike

我有一个 grails 项目,我想将其部署在 Cloud Foundry 上,但控制台显示如下:

[CONTAINER] n.spring.CloudProfileApplicationContextInitializer INFO    Adding 'cloud' to list of active profiles
[CONTAINER] g.CloudPropertySourceApplicationContextInitializer INFO Adding 'cloud' PropertySource to ApplicationContext
[CONTAINER] udAutoReconfigurationApplicationContextInitializer INFO Adding cloud service auto-reconfiguration to ApplicationContext
[CONTAINER] ing.DataSourceCloudServiceBeanFactoryPostProcessor INFO Auto-reconfiguring beans of type javax.sql.DataSource
[CONTAINER] ing.DataSourceCloudServiceBeanFactoryPostProcessor INFO No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
[CONTAINER] lina.core.ContainerBase.[Catalina].[localhost].[/] SEVERE Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException: Cannot invoke method getAt() on null object
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
Caused by: java.lang.NullPointerException: Cannot invoke method getAt() on null object
at java.lang.Thread.run(Thread.java:745)
[CONTAINER] org.apache.catalina.core.StandardContext SEVERE Error listenerStart
... 5 more
[CONTAINER] org.apache.catalina.util.SessionIdGeneratorBase INFO Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [135] milliseconds.
[CONTAINER] org.apache.catalina.core.StandardContext SEVERE Context [] startup failed due to previous errors
[CONTAINER] org.apache.catalina.loader.WebappClassLoader WARNING The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
[CONTAINER] org.apache.catalina.loader.WebappClassLoader WARNING The web application [] registered the JDBC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
java.lang.Object.wait(Native Method)
[CONTAINER] org.apache.catalina.loader.WebappClassLoader WARNING The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:142)

我认为这是 DB Conex 的问题,但我不知道如何解决。我在我的应用程序和服务计划 ClearDB MySQL 数据库 Spark DB 中使用 MySQL。

我的Datasource.groovy是:

import org.springframework.cloud.CloudFactory

def cloud

try {
cloud = new CloudFactory().cloud
} catch(e) {}

dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
username = "root"
password = "root"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
//cache.region.factory_class = 'org.hibernate.cache.EhCacheProvider'
}
environments {
development {
dataSource {
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:8080/bbddSRL"
username="root"
password="root"
}
}
test {
dataSource {
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:8080/bbddSRL"
username="root"
password="root"
}
}
production {
dataSource {
pooled = true
dbCreate = 'update'
driverClassName = 'com.mysql.jdbc.Driver'

if (cloud) {
def dbInfo = cloud.getServiceInfo('mysql-instance') //mysql-instance is the name of the ClearDB's service.
url = dbInfo.jdbcUrl
username = dbInfo.userName
password = dbInfo.password
} else {
url = 'jdbc:mysql://localhost:8080/bbddSRLprod'
username = 'root'
password = 'root'
}
}
}
}

有什么答案或建议吗?

最佳答案

尝试消除定义方言的数据源 block 。您仍然必须定义该 block 中的项目,但要在每个环境的数据源中进行定义。我这样做是因为我对环境中的数据源所做的任何更改似乎都没有效果。

关于mysql - Grails 中的 Cloud Foundry v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26144040/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com