Datasource <default> not started: driver and/or url are not defined.

2,305 views
Skip to first unread message

Nweike Onwuyali

unread,
Nov 7, 2019, 11:38:28 AM11/7/19
to Quarkus Development mailing list
I am using Quarkus 1.0.0.CR1 with the following dependency:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-mariadb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
and here is my configuration in application.properties  
quarkus.datasource.url=jdbc:mariadb://localhost:3306/xxx
quarkus.datasource.driver=org.mariadb.jdbc.Driver
quarkus.datasource.username=root
quarkus.datasource.password=password
quarkus.datasource.min-size=3
quarkus.datasource.max-size=13
And i Inject my datasource like this:
@Inject
AgroalDataSource dataSource;

However, i get this error when i try to access dataSource

2019-11-07 16:31:42,267 WARN  [io.qua.agr.run.AbstractDataSourceProducer] (vert.x-worker-thread-11) Datasource <default> not started: driver and/or url are not defined.
2019-11-07 16:31:42,268 ERROR [com.zip.pro.bul.end.TutorialService] (vert.x-worker-thread-11) createPerson: java.lang.Exception: Couldn't open connection to database: Normal scoped producer method may not return null: io.quarkus.agroal.runtime.DataSourceProducer.createDefaultDataSource()

'Weike



Nweike Onwuyali

unread,
Nov 7, 2019, 1:35:13 PM11/7/19
to Quarkus Development mailing list
I think i have figured out what the problem is. It may be a bug
I Changed the configuration to:
quarkus.datasource.db1.url=jdbc:mysql://localhost:3306/xxx
quarkus.datasource.db1.driver=com.mysql.cj.jdbc.Driver
quarkus.datasource.db1.username=root
quarkus.datasource.db1.password=password
quarkus.datasource.db1.min-size=3
quarkus.datasource.db1.max-size=13
and the injection to 

@Inject
@DataSource("db1")
AgroalDataSource dataSource;
and it worked!

'Weike

Guillaume Smet

unread,
Nov 7, 2019, 6:02:32 PM11/7/19
to nweikeo...@gmail.com, Quarkus Development mailing list
Could you create a reproducer and create an issue with it attached?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/d437f426-5248-4dd6-8e55-9b9c259353cb%40googlegroups.com.

Emmanuel Bernard

unread,
Nov 7, 2019, 6:19:04 PM11/7/19
to guillau...@gmail.com, Quarkus Development mailing list, nweikeo...@gmail.com
Yes at best our error report is misleading and also mention that 
https://quarkus.io/guides/datasource does not mention the drivers to use. (Maybe that’s optional though). 

Nweike Onwuyali

unread,
Nov 7, 2019, 6:46:53 PM11/7/19
to Quarkus Development mailing list
I think the error message is correct and it has nothing to do with the driver, but more on the configuration:
quarkus.datasource.db1.url=jdbc:mariadb://localhost:3306/iihpiz
quarkus.datasource.db1.driver=org.mariadb.jdbc.Driver
quarkus.datasource.db1.username=root
quarkus.datasource.db1.password=password
quarkus.datasource.db1.min-size=3
quarkus.datasource.db1.max-size=13
The above also works.

My conclusion is without annotating @DataSource("db1") , Quarkus cannot read the configuration in the application.properties, hence { Datasource <default> not started: driver and/or url are not defined.}. But as soon as i added the optional name in  quarkus.datasource.[optional name.][datasource property]., irrespective of the drivers, it started working

'Weike

On Thursday, November 7, 2019 at 11:19:04 PM UTC, Emmanuel Bernard wrote:
Yes at best our error report is misleading and also mention that 
https://quarkus.io/guides/datasource does not mention the drivers to use. (Maybe that’s optional though). 
To unsubscribe from this group and stop receiving emails from it, send an email to quark...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quark...@googlegroups.com.

Nweike Onwuyali

unread,
Nov 7, 2019, 6:47:21 PM11/7/19
to Quarkus Development mailing list
Sure, Will do
To unsubscribe from this group and stop receiving emails from it, send an email to quark...@googlegroups.com.

K. De Metter

unread,
Nov 22, 2019, 3:28:28 AM11/22/19
to Quarkus Development mailing list
Just wanted to raise this in case someone else has this issue.
I got this message when following the tutorial on using Hibernate ORM and JPA with Quarkus (https://quarkus.io/guides/hibernate-orm)

The problem I faced ( which isn't mentioned in that tutorial) , is that I had forgotten to add the Agroal dependency.
However, this message doesn't make that very.

In hindsight, I should have looked at 'configuring your datasources' first, which does explain it.
Lesson learned but perhaps a warning could be added to that guide that this must be done first ?

Sanne Grinovero

unread,
Nov 22, 2019, 4:25:49 AM11/22/19
to kdemet...@gmail.com, Quarkus Development mailing list
Didn't you have the dependency on the `quarkus-hibernate-orm` extension?

The Agroal dependency is a transitive dependency of that, so there
should be no need to ask for the agroal extension as well.

Thanks
Reply all
Reply to author
Forward
0 new messages