我的应用程序在本地运行良好,但是当我部署到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&characterEncoding=utf8&useSSL=false
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}
如果您的Heroku帐户尚未通过验证,则无法安装附加组件(例如数据库附加组件)。您可以通过在Heroku的信息中心中添加信用卡来解决此问题。完整说明可在Heroku的文档中找到:
验证您的Heroku帐户:
1)转到您的帐户页面。
2)点击结算标签。
3)点击添加信用卡。
现在,在JHipster v4.5.3 +中的部署过程中会打印此错误,在以前的版本中,它已被静默忽略。
我有一个来自REST服务的JSON: 我正在使用java-json.jar来解析这个JSON,这是我试图传递到JSON字符串上方的简单片段: 但我得到了下面的例外: 首先,我假设这是因为JSON中的和字符,并尝试替换如下: 但即便如此,我也遇到了同样的例外。谁能指导我知道我做错了什么吗?
我试图在linux中从命令行区分两个数据库。我希望有人能告诉我我做错了什么。。。我的命令是 我得到了这样的回应: java-cp“:/home/someguy/needit/liquibase/liquibase.jar:/home/someguy/needit/liquibase/lib/:/home/someguy/needit/liquibase/lib/slf4j-1.7.25.jar:/
我用RSA实现了数据加密/解密。如果我只是在本地加密/解密,它可以工作,但是如果我发送加密的数据,我会得到BadPaddingException:数据必须从零开始。 为了通过网络发送数据,我需要在客户端将数据从字节数组改为字符串(我以报头的形式发送),然后在服务器端检索数据并将其改回字节数组。 这里是我的本地加密/解密代码(我使用私钥加密,使用公钥解密): DecryptedString和mess
JSONException:JSONObject文本必须以字符6处的{开头。
我有udpclient类,我尝试获取jsonObject来侦听udpserver,我不知道这段代码是否正确,我的udpclient类是这样的
我参考了许多解析此链接的解决方案,但仍然遇到相同的错误。可以给我一个简单的解决方案来解析它。