Modular Spring app can't find persistence provider

Hi, I'm trying to run my JPMS app through the command line instead of IntelliJ. I set up maven to copy all dependencies to a specified folder, so that they can be added to the module path. I use the following command to start the app:
java --module-path "infodb-app-1.0-SNAPSHOT.jar;modules" --add-reads ovh.eukon05.infodb.app=ALL-UNNAMED -m ovh.eukon05.infodb.app/ovh.eukon05.infodb.app.Main -Dinfodb.sources.articlelimit=5 -Dinfodb.hibernate.db.user=sa -Dinfodb.hibernate.db.pass= -Dinfodb.hibernate.db.url="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"
java --module-path "infodb-app-1.0-SNAPSHOT.jar;modules" --add-reads ovh.eukon05.infodb.app=ALL-UNNAMED -m ovh.eukon05.infodb.app/ovh.eukon05.infodb.app.Main -Dinfodb.sources.articlelimit=5 -Dinfodb.hibernate.db.user=sa -Dinfodb.hibernate.db.pass= -Dinfodb.hibernate.db.url="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"
The app starts, but crashes saying that it couldn't instantiate a class responsible for database connectivity due to the lack of a persistence provider. I can't figure out why it is that way, because Hibernate is shown to be loaded to the module path when I use --show-module-resolution and persistence.xml is present in the META-INF folder of the module responsible for DB connectivity. Link to the repo: https://github.com/Eukon05/infodb
10 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Eukon05! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
puggy
puggy2mo ago
Hey @Eukon05, Could you post stacktrace for better understanding the issue? Thanks.
Eukon05
Eukon05OP2mo ago
sure, give me a sec
Eukon05
Eukon05OP2mo ago
puggy
puggy2mo ago
@Eukon05 I checked the repo you've shared and can say: 1. You have incorrect version in persistence.xml . I checked pom.xml and you are using Hibernate 6 version. It means you need to put 3.1 instead of 2 2. Also in pom.xml i see you are using H2 db, but dependency is in test scope. put it to runtime as you dont have any other driver in your configuration At least these 2 items should be fixed
No description
Eukon05
Eukon05OP2mo ago
Thank you! I'll try it out and let you know if it helped
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Eukon05
Eukon05OP2mo ago
Unfortunatelty, it didn't work The stack trace seems the same, but this is what i get:
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@352745203322585088>.

Did you find this page helpful?