-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Quarkus 3.15.2/3.17.0 with 2 datasources gives "Unable to find datasource '<default>' for persistence unit '<default>'" error #44807
Comments
/cc @geoand (kotlin) |
Thanks for reporting. I created a reproducer here, since I had to: https://github.com/yrodiere/quarkus-playground/tree/i44807 The last commit works around the problem. Last commit,
So. It would seem that Renaming Hey @radcortez, does that make sense to you? Is this a known issue? @nithom1 as a workaround I'd recommend just moving |
Yes, when using profile aware files, we require the main file also to be present: I guess that we don't have that clarified in the YAML documentation. |
Here is an explanation for it: |
@yrodiere it doenst work for me either, I get the same problem, even if I put everything into |
@nithom1 I just cleaned my workspace and tried your reproducer after applying my workaround again, and moving everything to |
Thanks, that explains the requirement. Would it be technically possible to add a warning, or even fail on bootstrap, when the |
@yrodiere with application.yaml
Gives above described error.
|
Counterpoint, when I do this, it works here: https://github.com/yrodiere/quarkus-playground/tree/i44807-nithom1 (it's a new branch, with your exact change) If you want us to debug please provide an actual, executable project. The problem is not obvious, there's a small detail in your app causing the problem, so it's just wasting everyone's time to exchange claims without ways to investigate. |
Yes, I think we can do it. In build time, we can catch all the resources available in the classpath. At runtime we don't need to worry about it because we already did that check. We only need to check the |
I dont want so waste someones time! Both times built with: |
Thanks, done: #44871 |
Okay, if you do So you can confirm that the config you posted, where |
So you can confirm that the config you posted, where
But I can also confirm building with gradle creates this error, also when build.gradle:
gradle.properties:
|
Please provide a reproducer. A zip, a link to a GitHub repository -- anything, as long as it's complete. Thank you. |
Describe the bug
Iam using Quarkus 3.15.2/3.17.0 with datasources MSSQL(default datasource) and POSTGRESSQL(additional datasource, called "targetdb") and getting stacktrace below.
I use entity managers annotated with org.quarkus.hibernate.orm.PersitenceUnit and want to use the classes of model for both Repositories(which use internal only the annotaded EntityManager) iam not using Panache. EntityManager in the first Repository is annotated with
@PersitenceUnit(PersitenceUnit.DEFAULT)
and in the second repository@PersitenceUnit("targetdb")
I try to start quarkus dev with the application-dev.yaml
I also tried with different modelclasses and with panache but as soon I use
@PersitenceUnit
annotation i get the same errror.Expected behavior
Quarkus is working with 2 datasources and shared model classes. Without error.
Actual behavior
Followein error is thrown on startup:
How to Reproduce?
Create project with foolwoing settings and execute dev env.
application-dev.yaml
TargetRepository.java
SourceRepository.java
Manager.java
Output of
uname -a
orver
Linux MintPC 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk 21.0.4 2024-07-16 OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu222.04) OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)
Quarkus version or git rev
3.15.2 / 3.17.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)------------------------------------------------------------ Gradle 8.6 ------------------------------------------------------------ Build time: 2024-02-02 16:47:16 UTC Revision: d55c486870a0dc6f6278f53d21381396d0741c6e Kotlin: 1.9.20 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21.0.4 (Ubuntu 21.0.4+7-Ubuntu-1ubuntu222.04) OS: Linux 5.15.0-124-generic amd64
Additional information
No response
The text was updated successfully, but these errors were encountered: