小编典典

在Heroku上出现JHipster“ URL必须以'jdbc'开头”错误

spring-boot

我的应用程序在本地运行良好,但是当我部署到heroku时,出现了应用程序错误。我尝试过几次相同的事情。我检查了数据库连接,一切都很好。这些是我的日志

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

编辑 :applicaiton-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

applicaiton-heroku.yml:

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

阅读 710

收藏
2020-05-30

共1个答案

小编典典

如果您的Heroku帐户尚未通过验证,则无法安装附加组件(例如数据库附加组件)。您可以通过在Heroku的信息中心中添加信用卡来解决此问题。完整说明可在Heroku的文档中找到:

验证您的Heroku帐户:

1)转到您的帐户页面。

2)点击结算标签。

3)点击添加信用卡。

现在,在JHipster v4.5.3 +中的部署过程中会打印此错误,在以前的版本中,它已被静默忽略。

2020-05-30