2016-01-27 40 views
0

我想創建我的第一個Spring Boot應用程序,並且我有一個與數據庫連接的issu。春季啓動應用程序 - 如何進行數據庫連接?

在運行,我有一個

值java.sql.SQLException:Driver.com.musql.jdbc.Driver其(在底部的完整的錯誤)返回null

當我連接到我的本地主機的數據庫沒有Spring Boot這是完美的,我測試了這段代碼:

try { 
     Class.forName("com.mysql.jdbc.Driver"); 
     java.sql.Connection connection = DriverManager 
     .getConnection("jdbc:mysql://127.0.0.1:3306/logsdb","logsdb", "logsdb"); 
     System.out.println("connection ok"); 
     System.out.println(connection.getCatalog()); 
    } catch (SQLException e) { 
     System.out.println("Connection Failed! Check output console"); 
     e.printStackTrace(); 
     return; 
    } 

這將返回我在localhost中創建的數據庫。

但它不適用於Spring引導。

我跟着這個教程:http://spring.io/guides/gs/batch-processing/#scratch

Screen of the structure of the project on this link

我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>com.toto.logsDB</groupId> 
<artifactId>logsDB</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>jar</packaging> 

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.3.1.RELEASE</version> 
</parent> 

<properties> 
    <java.version>1.7</java.version> 
</properties> 

<dependencies> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-batch</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-jdbc</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
    </dependency> 
</dependencies> 


<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 

我 「application.properties」:

spring.datasource.url= jdbc:mysql//localhost:3306/logsdb 
spring.datasource.username=logsdb 
spring.datasource.password=logsdb 
spring.datasource.driverClassName=com.mysql.jdbc.Driver 

錯誤:

 2016-01-27 14:18:12.396 INFO 3436 --- [   main] c.toto.logsDB.application.Application : Starting Application on EB-OR6105938 with PID 3436 (C:\workspaceLogs\target\classes started by GGFF7580 in C:\workspaceLogs) 
    2016-01-27 14:18:12.398 INFO 3436 --- [   main] c.toto.logsDB.application.Application : No active profile set, falling back to default profiles: default 
    2016-01-27 14:18:12.425 INFO 3436 --- [   main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]10f93f9: startup date [Wed Jan 27 14:18:12 CET 2016]; root of context hierarchy 
    2016-01-27 14:18:12.807 WARN 3436 --- [   main] o.s.c.a.ConfigurationClassEnhancer  : @Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details. 
    2016-01-27 14:18:12.814 WARN 3436 --- [   main] o.s.c.a.ConfigurationClassEnhancer  : @Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details. 
    2016-01-27 14:18:13.112 ERROR 3436 --- [   main] o.a.tomcat.jdbc.pool.ConnectionPool  : Unable to create initial connections of pool. 

    **java.sql.SQLException: Driver:[email protected] returned null for URL:jdbc:mysql//localhost:3306/logsdb** 
     at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:326) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102) [tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126) [tomcat-jdbc-8.0.30.jar:na] 
     at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:289) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:329) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:95) [spring-batch-infrastructure-3.0.6.RELEASE.jar:3.0.6.RELEASE] 
     at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:71) [spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.initialize(BatchDatabaseInitializer.java:50) [spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_21] 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_21] 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_21] 
     at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at com.toto.logsDB.application.Application.main(Application.java:37) [classes/:na] 

    2016-01-27 14:18:13.113 WARN 3436 --- [   main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unable to detect database type 
    2016-01-27 14:18:13.114 INFO 3436 --- [   main] o.s.j.e.a.AnnotationMBeanExporter  : Unregistering JMX-exposed beans on shutdown 
    2016-01-27 14:18:13.115 ERROR 3436 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is **java.lang.IllegalStateException**: **Unable to detect database type** 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at com.toto.logsDB.application.Application.main(Application.java:37) [classes/:na] 
    Caused by: java.lang.IllegalStateException: Unable to detect database type 
     at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:74) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.initialize(BatchDatabaseInitializer.java:50) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_21] 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_21] 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_21] 
     at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     ... 17 common frames omitted 
    Caused by: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is **org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:[email protected] returned null for URL:jdbc:mysql//localhost:3306/logsdb** 
     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:302) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:329) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:95) ~[spring-batch-infrastructure-3.0.6.RELEASE.jar:3.0.6.RELEASE] 
     at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:71) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] 
     ... 25 common frames omitted 
    Caused by: **org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection**; nested exception is java.sql.SQLException: Driver:[email protected] returned null for URL:jdbc:mysql//localhost:3306/logsdb 
     at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:289) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     ... 28 common frames omitted 
    Caused by: java.sql.SQLException: Driver:[email protected] returned null for URL:jdbc:mysql//localhost:3306/logsdb 
     at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:326) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126) ~[tomcat-jdbc-8.0.30.jar:na] 
     at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] 
     ... 29 common frames omitted 

    2016-01-27 14:18:13.117 INFO 3436 --- [   main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/workspaceLogs/target/classes/, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-batch/1.3.1.RELEASE/spring-boot-starter-batch-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter/1.3.1.RELEASE/spring-boot-starter-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot/1.3.1.RELEASE/spring-boot-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.1.RELEASE/spring-boot-autoconfigure-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.1.RELEASE/spring-boot-starter-logging-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/slf4j-api/1.7.13/slf4j-api-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/jcl-over-slf4j/1.7.13/jcl-over-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/jul-to-slf4j/1.7.13/jul-to-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/log4j-over-slf4j/1.7.13/log4j-over-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-core/4.2.4.RELEASE/spring-core-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/hsqldb/hsqldb/2.3.3/hsqldb-2.3.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-jdbc/4.2.4.RELEASE/spring-jdbc-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-beans/4.2.4.RELEASE/spring-beans-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-tx/4.2.4.RELEASE/spring-tx-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/batch/spring-batch-core/3.0.6.RELEASE/spring-batch-core-3.0.6.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/com/ibm/jbatch/com.ibm.jbatch-tck-spi/1.0/com.ibm.jbatch-tck-spi-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/javax/batch/javax.batch-api/1.0/javax.batch-api-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/com/thoughtworks/xstream/xstream/1.4.7/xstream-1.4.7.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/batch/spring-batch-infrastructure/3.0.6.RELEASE/spring-batch-infrastructure-3.0.6.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/retry/spring-retry/1.1.2.RELEASE/spring-retry-1.1.2.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-aop/4.2.4.RELEASE/spring-aop-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-context/4.2.4.RELEASE/spring-context-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-expression/4.2.4.RELEASE/spring-expression-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.3.1.RELEASE/spring-boot-starter-jdbc-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/apache/tomcat/tomcat-jdbc/8.0.30/tomcat-jdbc-8.0.30.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/apache/tomcat/tomcat-juli/8.0.30/tomcat-juli-8.0.30.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar] 

我讀了很多關於計算器的職位,但我沒能找到很好的解決辦法,如果你有一個想法..

最佳問候, 吉米

回答

2

您在jdbc網址中有拼寫錯誤。它應該是(注意:):

spring.datasource.url= jdbc:mysql://localhost:3306/logsdb 
+0

哦,我是一個如此笨蛋,我想了很多事情,但我沒有注意到這個..大聲笑感謝很多faterdy! –

+0

是什麼問題?他使用127.0.0.1而不是本地主機? – santafebound

+0

否 - 錯誤是無效的jdbc-url。只要看看這個問題 - 「application.properties」部分 – fateddy

1

改變你的財產spring.datasource.url= jdbc:mysql://localhost:3306/logsdb。您在mysql之後錯過了:spinrg.datasource.url因此您得到了錯誤java.sql.SQLException: Driver:[email protected] returned null for URL:jdbc:mysql//localhost:3306/logsdb

+1

你是對的,非常感謝@TimeTravel! –