2016-06-14 3 views
0

API를 만들려고합니다. 나는 Spring으로 만들려고한다. & Intellij Idea를 사용하여 Hibernate를 사용 했었고 나는 그것들을 사용한 적이 없다.빈 메이븐 프로젝트를 만들 수 없습니다.

저는 intellij로 Spring 프로젝트를 만드는 데 성공했습니다. 그러나 프로젝트가 '비어있다'고하더라도, 나는 아직 아무것도 변경하지 않았다. 나는 그것을 설치할 수 없다.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) 
    at [...] 

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) 
    at [...] 

    Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:180) 
    at [...] 

내 pom.xml 파일 http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0

<groupId>com.bloombooking.api</groupId> 
    <artifactId>bloombookingapi</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>bloombookingapi</name> 
    <description></description> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.3.5.RELEASE</version> 
     <relativePath/> <!-- lookup parent from repository --> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <java.version>1.8</java.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

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


</project> 

아마 내가 어떤 종류의 필요 하지만 어딘가 속성의 난 ... 어디에 넣어 어떤 사람과 당신은 당신의 클래스 패스에 DB의 JAR 누락

답변

0

문제점을 발견했습니다!

그래서 내가 말한대로 구성하지 않았다는 것이 었습니다. 대한 /main/ressources/application.properties

spring.jpa.database=POSTGRESQL 
spring.datasource.platform=postgres 
spring.jpa.show-sql=true 
spring.jpa.hibernate.ddl-auto=create-drop 
spring.database.driverClassName=org.postgresql.Driver 
spring.datasource.url=jdbc:postgresql://localhost:5432/mybase 
spring.datasource.username=username 
spring.datasource.password=mdp 

들으 : I는 JDBC (내가 필요하지 않은 이유를 알고하지 않습니다)하지만, 그냥 파일에 일부 속성을 넣어를 설치하는 데 필요하지 않았다 어쨌든 답변 :

-1

몰라요. 당신이 메이븐/Gradle을를 사용하는 경우, 단지 JDBC 드라이버 D를 포함 귀하의 POM/gradle 파일에 대한 의존성.

여기에서 촬영 : 그것은 설치 "MVN에 수동으로 추가 작동하지 않는 경우

<!-- ORACLE database driver --> 
    <dependency> 
     <groupId>com.oracle</groupId> 
     <artifactId>ojdbc6</artifactId> 
     <version>11.2.0</version> 
    </dependency> 

: 첫 번째 시도가 당신의 치어에 종속성을 추가 할 Spring Boot: Unable to configure

으로 설치 -file "목표 ...

+0

좋아, 그래서 난 단지 postgresql jdbc 항아리를 다운로드하고 내 프로젝트 어딘가에 넣어해야합니까? 정확히 어디에 ? (ressources에 넣으려고하면 같은 오류가 발생하지 않습니다.) – Antoine

+0

가장 깨끗한 방법은 로컬 Maven 저장소에 설치하고 의존성으로 추가하는 것입니다. http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/ – Pace

+0

괜찮 았어.하지만 어떻게 내 Intellij에서 theses 명령을 사용할 수 있습니까? 생각? – Antoine

관련 문제