gpt4 book ai didi

java - 在heroku上部署jhipster时出现sql驱动程序问题

转载 作者:行者123 更新时间:2023-12-01 10:26:31 25 4
gpt4 key购买 nike

我正在尝试将基于 jhipster 的 Web 应用程序部署到 heroku + cleardb 插件。我的应用程序使用 mysql 作为数据库,并且在本地工作正常。我已经遵循了heroku java教程中提到的所有步骤,但是当启动我的dynos时,我收到以下错误

 
2016-02-11T07:04:21.794363+00:00 app[web.1]: 2016-02-11 07:04:21.794 DEBUG 3 --- [ost-startStop-1] e.s.config.DatabaseConfiguration : Configuring Liquibase
2016-02-11T07:04:21.895998+00:00 app[web.1]: 2016-02-11 07:04:21.891 WARN 3 --- [hool-Executor-1] e.s.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2016-02-11T07:04:22.119284+00:00 app[web.1]: 2016-02-11 07:04:22.118 ERROR 3 --- [hool-Executor-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
2016-02-11T07:04:22.119292+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.119293+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) [tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.119295+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:141) [tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.119298+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126) [tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.119298+00:00 app[web.1]: at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388) [liquibase-core-3.4.2.jar!/:na]
2016-02-11T07:04:22.119300+00:00 app[web.1]: at edu.smartschool.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:49) [classes!/:na]
2016-02-11T07:04:22.119301+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.119303+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.119304+00:00 app[web.1]: Caused by: java.lang.InstantiationException: java.sql.Driver
2016-02-11T07:04:22.119305+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.119306+00:00 app[web.1]: ... 14 common frames omitted
2016-02-11T07:04:22.119308+00:00 app[web.1]: at java.lang.Class.newInstance(Class.java:412) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.119309+00:00 app[web.1]: ... 15 common frames omitted
2016-02-11T07:04:22.140522+00:00 app[web.1]: at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:393) ~[liquibase-core-3.4.2.jar!/:na]
2016-02-11T07:04:22.140528+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.140532+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.140533+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.140535+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-02-11T07:04:22.140555+00:00 app[web.1]: Caused by: java.lang.InstantiationException: java.sql.Driver
2016-02-11T07:04:22.140558+00:00 app[web.1]: Caused by: java.lang.NoSuchMethodException: java.sql.Driver.()
2016-02-11T07:04:22.140559+00:00 app[web.1]: at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.140559+00:00 app[web.1]: at java.lang.Class.newInstance(Class.java:412) ~[na:1.8.0_72-cedar14]
2016-02-11T07:04:22.140560+00:00 app[web.1]: ... 15 common frames omitted
2016-02-11T07:04:22.140560+00:00 app[web.1]: 2016-02-11T07:04:22.140560+00:00 app[web.1]:
2016-02-11T07:04:24.574982+00:00 app[web.1]: 2016-02-11 07:04:24.571 ERROR 3 --- [ost-startStop-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.

I am using a java buildpack and my procfile is as follows:

java -jar target/*.war --spring.profiles.active=dev,heroku --server.port=8080 --jhipster.metrics.jmx.enabled=false --spring.datasource.maximumPoolSize=5

and finally my application.yml:

 
spring:
profiles:
active: dev
devtools:
restart:
enabled: true
livereload:
enabled: false # we use Grunt + BrowserSync for livereload
datasource:
driver-class-name: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
url: jdbc:mysql://localhost:3306/smartSchool?useUnicode=true&characterEncoding=utf8
name:
username: root
password:
jpa:
database-platform: org.hibernate.dialect.MySQLInnoDBDialect
database: MYSQL
show_sql: true
properties:
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
data:
elasticsearch:
cluster-name:
cluster-nodes:
properties:
path:
logs: target/elasticsearch/log
data: target/elasticsearch/data
mail:
host: localhost
messages:
cache-seconds: 1
thymeleaf:
cache: false<p></p>

<p>liquibase:
contexts: dev</p>

<p>server:
port: 8080</p>

<p>jhipster:
datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
cache: # Hibernate 2nd level cache, used by CacheConfiguration
timeToLiveSeconds: 3600
ehcache:
maxBytesLocalHeap: 16M
mail: # specific JHipster mail property, for standard properties see MailProperties
from: smartSchool@localhost
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
spark:
enabled: false
host: localhost
port: 9999
graphite:
enabled: false
host: localhost
port: 2003
prefix: smartSchool
</p>

我按照建议将驱动程序更改为 com.mysql.jdbc.Driver:

  2016-02-12T14:18:17.950222+00:00 app[web.1]: 2016-02-12 14:18:17.950 DEBUG 3 --- [ost-startStop-1] e.s.config.DatabaseConfiguration         : Configuring Liquibase
2016-02-12T14:18:18.026114+00:00 app[web.1]: 2016-02-12 14:18:18.025 WARN 3 --- [hool-Executor-1] e.s.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2016-02-12T14:18:19.585825+00:00 app[web.1]: 2016-02-12 14:18:19.584 ERROR 3 --- [hool-Executor-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
2016-02-12T14:18:19.585828+00:00 app[web.1]: 2016-02-12T14:18:19.585828+00:00 app[web.1]:
2016-02-12T14:18:19.585830+00:00 app[web.1]: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
2016-02-12T14:18:19.585830+00:00 app[web.1]: 2016-02-12T14:18:19.585830+00:00 app[web.1]:
2016-02-12T14:18:19.585831+00:00 app[web.1]: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2016-02-12T14:18:19.585832+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:19.585835+00:00 app[web.1]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:19.585835+00:00 app[web.1]: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:19.585836+00:00 app[web.1]: at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585837+00:00 app[web.1]: at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585837+00:00 app[web.1]: at com.mysql.jdbc.MysqlIO.(MysqlIO.java:339) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585838+00:00 app[web.1]: at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585843+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:19.585846+00:00 app[web.1]: at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585847+00:00 app[web.1]: at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:19.585851+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:141) [tomcat-jdbc-8.0.30.jar!/:na]
2016-02-12T14:18:19.585876+00:00 app[web.1]: at edu.smartschool.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:63) [classes!/:na]
2016-02-12T14:18:19.585877+00:00 app[web.1]: at edu.smartschool.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:49) [classes!/:na]
2016-02-12T14:18:19.595844+00:00 app[web.1]: 2016-02-12T14:18:19.595844+00:00 app[web.1]:
2016-02-12T14:18:19.595882+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:21.938156+00:00 app[web.1]: 2016-02-12 14:18:21.937 ERROR 3 --- [ost-startStop-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
2016-02-12T14:18:21.938160+00:00 app[web.1]: 2016-02-12T14:18:21.938160+00:00 app[web.1]:
2016-02-12T14:18:21.938164+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:21.938165+00:00 app[web.1]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:21.938168+00:00 app[web.1]: at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:21.938169+00:00 app[web.1]: at com.mysql.jdbc.MysqlIO.(MysqlIO.java:339) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:21.938179+00:00 app[web.1]: at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) ~[mysql-connector-java-5.1.38.jar!/:5.1.38]
2016-02-12T14:18:21.938204+00:00 app[web.1]: at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887) [hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-02-12T14:18:21.938208+00:00 app[web.1]: at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) [hibernate-entitymanager-4.3.11.Final.jar!/:4.3.11.Final]
2016-02-12T14:18:21.938209+00:00 app[web.1]: at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) [spring-orm-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938210+00:00 app[web.1]: at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) [spring-orm-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938211+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938212+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938213+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938225+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938231+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938269+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938270+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938271+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938271+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938278+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938283+00:00 app[web.1]: at org.springframework.security.config.annotation.web.configuration.AutowiredWebSecurityConfigurersIgnoreParents.getWebSecurityConfigurers(AutowiredWebSecurityConfigurersIgnoreParents.java:52) [spring-security-config-4.0.2.RELEASE.jar!/:4.0.2.RELEASE]
2016-02-12T14:18:21.938284+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72-cedar14]
2016-02-12T14:18:21.938290+00:00 app[web.1]: at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:113) [spring-expression-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938291+00:00 app[web.1]: at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129) [spring-expression-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938295+00:00 app[web.1]: at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:161) [spring-context-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938299+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938299+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938307+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938308+00:00 app[web.1]: at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) [spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
2016-02-12T14:18:21.938327+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72-cedar14]

I tried with yo jhipster:heroku but it doesn't work anymore.I have the following error:

 
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! path C:\Users\HP\AppData\Roaming\npm-cache\ini\1.3.4\package\package.js
on.773c5ce841908f51e5cb2a52f872a0ac
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

请帮忙!!!!

最佳答案

驱动程序类名不是数据源。

更改:

driver-class-name: com.mysql.jdbc.jdbc2.optional.MysqlDataSource

driver-class-name: com.mysql.jdbc.Driver

关于java - 在heroku上部署jhipster时出现sql驱动程序问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35333409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com