Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to determine a suitable driver class #13796

Closed
ghsatpute opened this issue Jul 17, 2018 · 20 comments
Closed

Failed to determine a suitable driver class #13796

ghsatpute opened this issue Jul 17, 2018 · 20 comments

Comments

@ghsatpute
Copy link

Spring Boot Version: 2.0.3.RELEASE

application.properties

###--- Database   ---###
spring.datasource.url = jdbc:mysql://localhost:3306/mydb
spring.datasource.username = root
spring.datasource.password = password
spring.datasource.platform = mysql
spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto = create
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

Pom.xml contains

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

    ... 
        <!-- Database dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
    </dependencies>

When I run my application, I get following error

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-17 12:31:12.528 ERROR 15387 --- [           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).

After searching for a bit, I found that if I use earlier versions like 1.5.13.RELEASE this doesn't happen.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 17, 2018
@snicoll
Copy link
Member

snicoll commented Jul 17, 2018

Failure analysis doesn't match the bits of configuration you've shared. It's a bit unclear at this point where the problem can be. Rather than pasting code in text, please share a sample we can clone and run that reproduces the problem.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jul 17, 2018
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Jul 24, 2018
@charboubmustapha
Copy link

charboubmustapha commented Jul 25, 2018

Hello ,
I have the same issue using the version 2.0.0.RELEASE of spring boot using the configuration bellow :
spring: dao: exceptiontranslation: enabled: false datasource: url: jdbc:postgresql://localhost:35432/db?binaryTransferEnable=142 hikari: pool-name: junit-pool username: username password: password driver-class-name: org.postgresql.Driver

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jul 25, 2018
@snicoll
Copy link
Member

snicoll commented Jul 25, 2018

@MustaphaCH thank you for trying to help but that's not a sample we can clone and run ourselves. If you have one, we're more than happy to have a look.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 25, 2018
@charboubmustapha
Copy link

charboubmustapha commented Jul 25, 2018

@snicoll i attach the application.yml you could you check my configuration please ?
application.zip

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jul 25, 2018
@snicoll
Copy link
Member

snicoll commented Jul 25, 2018

@MustaphaCH thanks again but a configuration file is not a sample that we can run ourselves.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 25, 2018
@charboubmustapha
Copy link

@snicoll sorry the problem is fixed it was related to a profile.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jul 25, 2018
@philwebb philwebb added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Jul 26, 2018
@philwebb philwebb reopened this Jul 26, 2018
@philwebb philwebb added status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged and removed status: invalid An issue that we don't feel is valid labels Jul 26, 2018
@snicoll snicoll added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Jul 26, 2018
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Aug 9, 2018
@ghsatpute
Copy link
Author

ghsatpute commented Aug 15, 2018

Apologies for replying late, I was not able to isolate the issue but now I did and came here to give the solution.

My application organization looked like below

 Commons 
        |
        ↓
    Module1

Commons was a parent to Module1.

I had created a BaseEntity having JPA annotations in my commons module. The commons dependency was specified as

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

Once I added the <scope>provided</scope>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<scope>provided</scope>
		</dependency>

The issue got resolved for me. Unfortunately, I'm not able to do further analysis nor I can share the code.

@darm191065
Copy link

the same issue worked for me on the same release

Thank for the fix mate

@abhishekkarigar

This comment has been minimized.

@Tsakirogf
Copy link

Tsakirogf commented Dec 15, 2018

This fix worked for me as well, good job @ghsatpute.However I would like to put my experience. My project was working perfectly with Eclipse. I didn't have any problem with it before I move the project to intellij. Going back to eclipse and removing your fix, works.

@ghsatpute
Copy link
Author

@Tsakirogf always happy to help.
For me, it did work on IntelliJ after the fix.

@Tsakirogf
Copy link

Yes as I said, it worked for me.What I wanted to spot is that without the fix it was working for Eclipse.

@oselene
Copy link

oselene commented Jan 22, 2019

please can you explain where i can find the commons and module1 you identified in your explanation

@ghsatpute
Copy link
Author

@oselene Those are my projects and taken here as an example. For you, those modules would be different.

@Vyomsoft
Copy link

Hello,
I am facing the same issue with Spring boot 2.1.2 release

@snicoll
Copy link
Member

snicoll commented Feb 12, 2019

@premierDE that comment is not very helpful. If you need help, please consider asking a question on StackOverflow or join the community on Gitter. If you believe you've found a bug in Spring Boot, attach a minimal sample we can run ourselves and we can reopen this issue.

@trantienduchn
Copy link

I got the same problem with spring-boot 2.1.3 RELEASE. I marked my project with <packaging>pom</packaging> (stupid) so It didn't work, removing this resolved my issue.

@shaileshoptimizeq

This comment has been minimized.

@spring-projects spring-projects locked as resolved and limited conversation to collaborators Feb 27, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests