Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

APPLICATION FAILED TO START... Failed to configure a DataSource...

The GitHub project for the first video of the "Debugging an Existing Java Application" course never even compiled without errors for me. After a few changes, I think I was able to eliminate most issues except for this error:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-06-04 10:17:10.608 ERROR 17508 --- [ main] >o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded >datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

Process finished with exit code 1

Re-running with "debug" enabled yields no further information. As to the changes I made to the original project, there were basically 4:

  1. The build.gradle file has largely been reformatted to adhere to more modern syntax (at least that's my understanding). Also, I found the latest versions of all the dependencies. This was done because the first issue I encountered was that Gradle was not getting my dependencies. To solve this, I also installed locally the latest (5.4.1) version of Gradle and changed some of my IntelliJ settings. Under File > Settings... > Build, Execution, Deployment > Build Tools > Gradle, I selected "Use local Gradle distribution" instead of "Use default Gradle wrapper (recommended)" or "Use Gradle 'wrapper' task configuration". My Gradle JVM is java version "12.0.1". My build.gradle file is referenced below.
  2. Possibly because of Spring versioning issues, I had to change 2 lines in FlashCardServiceImpl.java. The first was the return statement of the method getFlashCardById was changed to return flashCardRepository.findById(id).get();.
  3. The second change to that file was the final return statement of the method getNextFlashCardBasedOnViews was changed to return flashCardRepository.findById(leastViewedId).get();.
  4. Similarly, I had to change the final code line in DatabaseLoader.java to flashCardRepository.saveAll(cards);.
plugins {
    id 'java'
    id 'org.springframework.boot' version '2.1.5.RELEASE'
}

group 'com.teamtreehouse'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.5.RELEASE'

    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.1.5.RELEASE'

    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.1.5.RELEASE'

    // https://mvnrepository.com/artifact/com.h2database/h2
    testCompile group: 'com.h2database', name: 'h2', version: '1.4.199'

    // https://mvnrepository.com/artifact/org.eclipse.mylyn.github/org.eclipse.egit.github.core
    compile group: 'org.eclipse.mylyn.github', name: 'org.eclipse.egit.github.core', version: '2.1.5'

    // https://mvnrepository.com/artifact/junit/junit
    testCompile group: 'junit', name: 'junit', version: '4.13-beta-3'
}