Skip to content

tomcat + spring boot : No suitable driver found #1246

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

Open
guiguilechat opened this issue Mar 13, 2025 · 5 comments
Open

tomcat + spring boot : No suitable driver found #1246

guiguilechat opened this issue Mar 13, 2025 · 5 comments

Comments

@guiguilechat
Copy link

guiguilechat commented Mar 13, 2025

Describe the bug
tomcat + spring boot
Caused by: java.sql.SQLException: No suitable driver found for jdbc:sqlite::memory:

To Reproduce

TLDR : clone my minimal project https://github.com/guiguilechat/xerial-sqlite-testtomcat and run the sh/test script


I created a spring boot app, that is built with maven-war-plugin (package phase, war type), and has the


		<dependency>
			<groupId>org.xerial</groupId>
			<artifactId>sqlite-jdbc</artifactId>
		</dependency>

(managed in root pom, v3.49.1.0)

I can run it locally with an main() calling SpringApplication.run
In that case it can open a connection to a new inmemory db no problem (which I use to load downloaded sqlite file and integrate the data).

However when I scp the war to the tomcat directory , the tomcat app complains

Caused by: java.sql.SQLException: No suitable driver found for jdbc:sqlite::memory:
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708) ~[java.sql:na]
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:253) ~[java.sql:na]

Environment (please complete the following information):

  • OS: [Ubuntu 24.04.2 LTS]
  • sqlite-jdbc 3.49.1.0

Additional context

I know of #145 (comment)
I tried this (by copying the plugin conf from https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/3.4.3/spring-boot-starter-parent-3.4.3.pom and adding the execution on package) but it did not work(same issue).

It's weird because the app runs against a postgresql instance (in the same server) and can find it no problem. I also added the oracle driver and was able to dockerize it against a oracle docker image.

Also when I look in the packaged war, there is no META-INF/services/java.sql.Driver ; only maven/ and MANIFEST.MF

@guiguilechat guiguilechat changed the title omcat + spring boot : No suitable driver found tomcat + spring boot : No suitable driver found Mar 13, 2025
@gotson
Copy link
Collaborator

gotson commented Mar 14, 2025

@guiguilechat
Copy link
Author

@gotson
Yes this is explained in the additional context.

@guiguilechat
Copy link
Author

added a minimal-ish maven project to test.
Uses docker to start a tomcat image

https://github.com/guiguilechat/xerial-sqlite-testtomcat

sh/test script does all.

Result for me :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-04-17T16:17:04.081Z ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadDB' defined in file [/usr/local/tomcat/webapps/TestXerialSqliteTomcat/WEB-INF/classes/fr/guiguilechat/tests/xerial/LoadDB.class]: No suitable driver found for jdbc:sqlite::memory:

While when running in Eclipse IDE : INFO 191800 --- [ main] fr.guiguilechat.tests.xerial.LoadDB : succesfuly loaded db

@guiguilechat
Copy link
Author

tried with tomcat image 11.0.6 and same issue.

@guiguilechat
Copy link
Author

forced the last version of xerials (dependency management) and added maven-shade transformer, no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants