Open mjurc opened 4 years ago
cc @Ladicek @rsvoboda @geoand @Sanne
Many thanks @mjurc , I'll look at this.
I don't have Openshift installed so I couldn't follow the reproducer instructions literally; I tried to convert the reproducer into a Quarkus integration test, but then it seems to work..
I suspect there's a shadowing problem with the script name: you have two import.sql
resources in the classpath. Could you try deleting (or renaming) /sql-db/app/src/main/resources/import.sql
?
I suspect it's being loaded instead of sql-db/mysql/src/main/resources/import.sql
, and the ordering rules might be different in the normal classloader vs the native one.
I think this reproducer doesn't need OpenShift, Michal mentions just Docker, that's why he references mjurc/quarkus-openshift-test-suite/ and local run like ./sql-db/mariadb/target/sql-db-mariadb-1.0.0-SNAPSHOT-runner
I think small change to the mvn command should be applied: -DskipTests
=> -DskipTests -DskipITs
@mjurc is on PTO, he will be back next week, @Sanne please try the reproducer with the above change
thanks, I tried with the above reproducer: if you delete /sql-db/app/src/main/resources/import.sql
the problem is solved.
(It's still a bit hard to actually ensure you get a clean build, as it seems I had trouble with the snapshots system: even after deleting the file and doing a mvn clean
, at first the second resource copy was still being included).
I wish we could detect duplicate resources being included, but this isn't something ORM can do; we probably want to look at making some improvements in Quarkus core. But this isn't a bug, I'd classify it as a request for enhancements.
I no longer recall why I added sql-db/app/src/main/resources/import.sql
, but I think it's for the "unit test" in the app
module. If I remember correctly, I tried to put it into sql-db/app/src/test/resources
, but it didn't work. I guess we could rename it and adjust sql-db/app/src/test/resources/application.properties
accordingly.
But a request for enhancement this totally is. (Hello Yoda!) I currently can't think of a better way of supporting multiple DBs with a single application than what I built in that test suite.
Used Fixes
keyword in PR in quarkus-qe/quarkus-openshift-test-suite which triggered auto-close of this issue after merge.
Add functionality to Quarkus to detect duplicate resources being included.
This issue was originally filed as bug and the investigation done by @Sanne revealed that there is a shadowing problem with the script name: there were two import.sql resources in the classpath. ORM itself can't detect duplicate resources; we probably want to look at making some improvements in Quarkus core.
Details from the originally filed bug: The SQL from
import.sql
results inCommandAcceptanceException
exceptions when native image is executed when using MariaDB 10.2/10.3 or MS SQL Server 2019. The very sameimport.sql
will execute properly when the same application is ran in JVM mode.Expected behavior The SQL from
import.sql
file gets executed without exceptions when running application working properly in JVM mode.Actual behavior Running Quarkus application from native image with the following
import.sql
will result in the following exceptions:
When MS SQL is used, the exceptions look like this:
The same
import.sql
will work in JVM mode.To Reproduce Steps to reproduce the behavior:
import.sql
is executed properly.import.sql
is executed properly.Configuration
Environment (please complete the following information):
uname -a
orver
:Linux tigris 5.7.14-200.fc32.x86_64 #1 SMP Fri Aug 7 23:16:37 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
java -version
:openjdk version "11.0.8" 2020-07-14
quarkus/ubi-quarkus-mandrel: 20.1.0.1.Alpha2-java11
1.6.0.Final
mvnw --version
orgradlew --version
):Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)