2017-06-13 55 views
0

錯誤我的應用程序在本地運行良好,但是當我部署到heroku時,出現了應用程序錯誤。我嘗試過幾次發生同樣的事情。我檢查數據庫連接,一切都很好。這是我的日誌JHipster「URL必須以'jdbc'」H​​eroku開頭

2017-06-13T09:20:30.840039+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
2017-06-13T09:20:30.840041+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) 
2017-06-13T09:20:30.840040+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) 
2017-06-13T09:20:30.840042+00:00 app[web.1]: at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) 
2017-06-13T09:20:30.840040+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) 
2017-06-13T09:20:30.840042+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 
2017-06-13T09:20:30.937134+00:00 app[web.1]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.ryantenney.metrics.spring.config.annotation.Dele 
gatingMetricsConfiguration': Unsatisfied dependency expressed through method 'setMetricsConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyExcep 
tion: Error creating bean with name 'metricsConfiguration': Unsatisfied dependency expressed through method 'setHikariDataSource' parameter 0; nested exception is org.springframework.beans.facto 
ry.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean insta 
ntiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSour 
ce' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc' 
2017-06-13T09:20:30.840043+00:00 app[web.1]: 
2017-06-13T09:20:30.937128+00:00 app[web.1]: 2017-06-13 09:20:30.935 ERROR 4 --- [   main] o.s.boot.SpringApplication    : Application startup failed 
2017-06-13T09:20:30.937130+00:00 app[web.1]: 
2017-06-13T09:20:30.937136+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProc 
essor.java:667) 
2017-06-13T09:20:30.937139+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) 
2017-06-13T09:20:30.937137+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 
2017-06-13T09:20:30.937138+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcesso 
r.java:366) 
2017-06-13T09:20:30.937140+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
2017-06-13T09:20:30.937139+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) 
2017-06-13T09:20:30.937143+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
2017-06-13T09:20:30.937141+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
2017-06-13T09:20:30.937141+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
2017-06-13T09:20:30.937142+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
2017-06-13T09:20:30.937143+00:00 app[web.1]: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372) 
2017-06-13T09:20:30.937146+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
2017-06-13T09:20:30.937144+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.j 
ava:1173) 
2017-06-13T09:20:30.937147+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
2017-06-13T09:20:30.937145+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
2017-06-13T09:20:30.937146+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
2017-06-13T09:20:30.937150+00:00 app[web.1]: at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:235) 
2017-06-13T09:20:30.937148+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
2017-06-13T09:20:30.937148+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
2017-06-13T09:20:30.937149+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
2017-06-13T09:20:30.937150+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:703) 
2017-06-13T09:20:30.937151+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) 
2017-06-13T09:20:30.937158+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) 
2017-06-13T09:20:30.937156+00:00 app[web.1]: at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 
2017-06-13T09:20:30.937159+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) 
2017-06-13T09:20:30.937157+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) 
2017-06-13T09:20:30.937160+00:00 app[web.1]: at com.mycompany.myapp.Blog3App.main(Blog3App.java:66) 
2017-06-13T09:20:30.937161+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
2017-06-13T09:20:30.937160+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
2017-06-13T09:20:30.937161+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
2017-06-13T09:20:30.937162+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) 
2017-06-13T09:20:30.937165+00:00 app[web.1]: at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) 
2017-06-13T09:20:30.937163+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) 
2017-06-13T09:20:30.937166+00:00 app[web.1]: Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'metricsConfiguration': Unsatisfied depend 
ency expressed through method 'setHikariDataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined i 
n class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.be 
ans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: U 
RL must start with 'jdbc' 
2017-06-13T09:20:30.937163+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) 
2017-06-13T09:20:30.937164+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 
2017-06-13T09:20:30.937169+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) 
2017-06-13T09:20:30.937167+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProc 
essor.java:667) 
2017-06-13T09:20:30.937167+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 
2017-06-13T09:20:30.937168+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcesso 
r.java:366) 
2017-06-13T09:20:30.937169+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) 
2017-06-13T09:20:30.937170+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
2017-06-13T09:20:30.937171+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
2017-06-13T09:20:30.937172+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
2017-06-13T09:20:30.937171+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
2017-06-13T09:20:30.937173+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
2017-06-13T09:20:30.937175+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1180) 
2017-06-13T09:20:30.937173+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) 
2017-06-13T09:20:30.937174+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316) 
2017-06-13T09:20:30.937175+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282) 
2017-06-13T09:20:30.937176+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) 
2017-06-13T09:20:30.937177+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) 
2017-06-13T09:20:30.937193+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/sp 
ringframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationExceptio 
n: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc' 
2017-06-13T09:20:30.937178+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProc 
essor.java:659) 
2017-06-13T09:20:30.937178+00:00 app[web.1]: ... 34 common frames omitted 
2017-06-13T09:20:30.937195+00:00 app[web.1]: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) 
2017-06-13T09:20:30.937196+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.j 
ava:1173) 
2017-06-13T09:20:30.937198+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 
2017-06-13T09:20:30.937196+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) 
2017-06-13T09:20:30.937197+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) 
2017-06-13T09:20:30.937201+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) 
2017-06-13T09:20:30.937199+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
2017-06-13T09:20:30.937202+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) 
2017-06-13T09:20:30.937199+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
2017-06-13T09:20:30.937200+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
2017-06-13T09:20:30.937200+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) 
2017-06-13T09:20:30.937205+00:00 app[web.1]: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSour 
ce' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc' 
2017-06-13T09:20:30.937202+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) 
2017-06-13T09:20:30.937203+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProc 
essor.java:659) 
2017-06-13T09:20:30.937204+00:00 app[web.1]: ... 50 common frames omitted 
2017-06-13T09:20:30.937206+00:00 app[web.1]: at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) 
2017-06-13T09:20:30.937209+00:00 app[web.1]: at org.springframework.util.Assert.isTrue(Assert.java:92) 
2017-06-13T09:20:30.937207+00:00 app[web.1]: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) 
2017-06-13T09:20:30.937209+00:00 app[web.1]: at org.springframework.boot.jdbc.DatabaseDriver.fromJdbcUrl(DatabaseDriver.java:268) 
2017-06-13T09:20:30.937207+00:00 app[web.1]: ... 62 common frames omitted 
2017-06-13T09:20:30.937208+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: URL must start with 'jdbc' 
2017-06-13T09:20:30.937212+00:00 app[web.1]: at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:80) 
2017-06-13T09:20:30.937210+00:00 app[web.1]: at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:238) 
2017-06-13T09:20:30.937211+00:00 app[web.1]: at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:183) 
2017-06-13T09:20:30.937211+00:00 app[web.1]: at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:42) 
2017-06-13T09:20:30.937215+00:00 app[web.1]: at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) 
2017-06-13T09:20:30.937213+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
2017-06-13T09:20:30.937216+00:00 app[web.1]: ... 63 common frames omitted 
2017-06-13T09:20:30.937213+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
2017-06-13T09:20:30.937214+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
2017-06-13T09:20:30.937215+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) 
2017-06-13T09:20:30.937217+00:00 app[web.1]: 
2017-06-13T09:20:31.436235+00:00 heroku[web.1]: Process exited with status 1 
2017-06-13T09:20:31.460943+00:00 heroku[web.1]: State changed from starting to crashed 
2017-06-13T09:24:12.753908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=serene-citadel-75498.herokuapp.com request_id=66b02e97-98a8-442c-85f1-d889ad25ec01 
fwd="84.54.96.137" dyno= connect= service= status=503 bytes= protocol=https 
2017-06-13T09:24:13.555911+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=serene-citadel-75498.herokuapp.com request_id=4a28374e-0005-4ed5-bc26-1b 
0a799f76bb fwd="84.54.96.137" dyno= connect= service= status=503 bytes= protocol=https 

編輯:應用程序了,prod.yml:

datasource: 
    type: com.zaxxer.hikari.HikariDataSource 
    url: jdbc:mysql://localhost:3306/db?useUnicode=true&characterEnco‌​ding=utf8&useSSL=fal‌​se 
    username: root 
    password: password 

應用程序了,heroku.yml:

datasource: 
    type: com.zaxxer.hikari.HikariDataSource 
    url: ${JDBC_DATABASE_URL} 
    username: ${JDBC_DATABASE_USERNAME} 
    password: ${JDBC_DATABASE_PASSWORD} 
+0

關鍵在於:'java.lang.IllegalArgumentException:URL必須以'jdbc'開頭你能發佈整個JDBC連接字符串嗎? – ppeterka

+0

數據源: **類型:** com.zaxxer.hikari.HikariDataSource **網址:** JDBC:MySQL的://本地主機:3306 /分貝了useUnicode =真的characterEncoding = UTF8&useSSL =假 **用戶名:**根 **密碼:**密碼 –

+1

您是否檢查過您的日誌中激活哪個配置文件? –

回答

1

如果您的Heroku帳戶尚未得到驗證,那麼你不能安裝AddOns(例如Database AddOn)。您可以通過在Heroku的儀表板中添加信用卡來解決此問題。完整說明可在Heroku's docs發現:

要驗證您的Heroku帳戶:

1)轉到您的帳戶頁面。

2)單擊「結算」選項卡。

3)點擊添加信用卡。

這個錯誤現在在JHipster v4.5.3部署+,在以前的版本中,它被悄悄地忽略在打印。

相關問題