2014-10-01 76 views
0

我有一个Grails项目,我想将它部署在Cloud Foundry,但控制台显示此:的Cloud Foundry V2 Grails中

[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 Database 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' 
      } 
     } 
    } 
} 

任何anwers或建议?

回答

0

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

+0

我删除了数据源块,但问题仍然存在。 :( – angelo087 2014-10-02 14:12:14

+0

没有人知道什么?=( – angelo087 2014-10-11 10:11:01