2017-10-01 3 views
0

私はWebアプリケーションプロジェクトを開始しています.MysqlをGrails 3に統合しようとしています。すべてのオンラインチュートリアルでは、現在(Application.ymlがあります)。mysqlまたはmongodbをgrailsに統合する方法3.2.10

私はApplication.ymlを公式ドキュメントに記載されているように変更しようとしましたが、大きなエラーが出ます。その新しいプロジェクトであり、それに他の変更はありません。私は以前にgrails 2.4を使っていましたが、それは本当に簡単でしたが、今、私は戻ってくることを考えています。

変更:私が得る

dataSource : 
pooled : true 
dbCreate : "update" 
url : "jdbc:mysql://localhost:3306/my_database" 
driverClassName : "com.mysql.jdbc.Driver" 
dialect : org.hibernate.dialect.MySQL5InnoDBDialect 
username : "username" 
password : "password" 
properties : 
    jmxEnabled : true 
    initialSize : 5 
    maxActive : 50 
    minIdle : 5 
    maxIdle : 25 
    maxWait : 10000 
    maxAge : 10 * 60000 
    timeBetweenEvictionRunsMillis : 5000 
    minEvictableIdleTimeMillis : 60000 
    validationQuery : "SELECT 1" 
    validationQueryTimeout : 3 
    validationInterval : 15000 
    testOnBorrow : true 
    testWhileIdle : true 
    testOnReturn : false 
    jdbcInterceptors : "ConnectionState;StatementCache(max=200)" 
    defaultTransactionIsolation : 
java.sql.Connection.TRANSACTION_READ_COMMITTED 

エラー:

/usr/lib/jvm/java-8-oracle/bin/java -XX:+TieredCompilation - 
XX:TieredStopAtLevel=1 -XX:CICompilerCount=3 -Dfile.encoding=UTF-8 - 
classpath /home/nischit/.gradle/caches/modules-2/files- 
2.1/org.grails/grails- 
shell/3.2.10/c6b000bbb8ac369a9be062f08e8a0a8d3f85705/grails-shell-    
3.2.10.jar:/home/nischit/.gradle/caches/modules-2/files- 
2.1/org.slf4j/slf4j- 
simple/1.7.25/8dacf9514f0c707cbbcdd6fd699e8940d42fb54e/slf4j-simple- 
1.7.25.jar:/home/nischit/.gradle/caches/modules-2/files- 
2.1/org.codehaus.plexus/plexus-component-api/1.0-alpha- 
33/7d9560effcadf867937ac6885d0d1045ea98ab59/plexus-component-api-1.0- 
alpha-33.jar:/home/nischit/.gradle/caches/modules-2/files 


Running application... 
2017-10-02 01:42:14.120 ERROR --- [ost-startStop-1] 
o.s.b.c.embedded.tomcat.TomcatStarter : Error starting Tomcat 
context. Exception: 
org.springframework.beans.factory.BeanCreationException. Message: 
Error creating bean with name 'grailsCacheFilter': Cannot create 
inner bean '(inner bean)#17d4fdc1' of type 
[grails.plugin.cache.web.filter. 
simple.MemoryPageFragmentCachingFilter] 
while setting bean property 'filter'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) 
    at grails.boot.GrailsApp.run(GrailsApp.groovy:83) 
    at grails.boot.GrailsApp.run(GrailsApp.groovy:388) 
    at grails.boot.GrailsApp.run(GrailsApp.groovy:375) 
    at grails.boot.GrailsApp$run.call(Unknown Source) 
    at 
org.codehaus.groovy.runtime.callsite.CallSiteArray. 
defaultCall(CallSiteArray.java:48) 
Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'grailsCacheFilter': Cannot create 
inner bean '(inner bean)#17d4fdc1' of type 
[grails.plugin.cache.web.filter.simple. 
MemoryPageFragmentCachingFilter] while setting bean property 
'filter'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error c 
reating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000" 
at 
org.springframework.beans.factory.support. 
BeanDefinitionValueResolver.resolveInnerBean 
(BeanDefinitionValueResolver.java:313) 
Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000" 
at 
org.springframework.beans.factory.annotation. 
AutowiredAnnotationBeanPostProcessor 
$AutowiredMethodElement.inject 
(AutowiredAnnotationBeanPostProcessor.java:667) 
Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000" 

FAILURE: Build failed with an exception. 
* What went wrong: 
Execution failed for task ':bootRun'. 
Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with 
non-zero exit value 1 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info 
or --debug option to get more log output. 
| Error Failed to start server (Use --stacktrace to see the full 
trace) 

答えて

1

問題は、あなたのデータソースにMAXAGE値を設定しようとしている方法である:

タイプ 'java.lang.String'のプロパティ値を に変換するのに失敗しました。プロパティ 'maxAge'に 'long'が必要です。ネストされた例外は java.lang.NumberFormatExceptionです:入力文字列の場合:「10 * 60000」

だけで計算するのではなく、具体的な値を設定してみてください。

0

もしあなたがYML標準に慣れていないなら、単にapplication.groovyという名前の新しいファイルを作成し、それをconfディレクトリの中に置き、そのgroovyファイルにデータソースブロックを追加してください。 application.ymlファイルからデータソースブロックを削除することを忘れないでください。

+0

私は、永続的な長いエラーのために、代わりにpythonのバックエンドとreactjsを使用して終了しました.. –

関連する問題