This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new dad551c71 fix(docker): launch the runtime with PropertiesLauncher so 
the MySQL driver loads (#6344)
dad551c71 is described below

commit dad551c712d2eaf9f4db34487126d517ea17c0e4
Author: lizhimins <[email protected]>
AuthorDate: Mon Oct 12 17:32:00 2026 +0800

    fix(docker): launch the runtime with PropertiesLauncher so the MySQL driver 
loads (#6344)
    
    mysql-connector-j is excluded from the fat JAR (GPL / ASF Category X) and 
downloaded into /app/lib at image build time, with LOADER_PATH meant to put it 
on the classpath. But `java -jar app.jar` runs the Main-Class that 
spring-boot-maven-plugin writes — JarLauncher — and JarLauncher does not read 
LOADER_PATH, only PropertiesLauncher does. Every image built since the 
connector moved out of the JAR therefore failed at startup with "Cannot load 
driver class: com.mysql.cj.jdbc.Driver".
    
    Verified on a built image before changing anything: Main-Class is 
JarLauncher, PropertiesLauncher.class is present in the JAR, BOOT-INF/lib 
carries no mysql entry, /app/lib holds mysql-connector-j-9.7.0.jar; launching 
the same image through PropertiesLauncher reaches HikariPool-1 - Starting.
    
    -Dloader.path is passed explicitly rather than relying on the env var, so 
the entrypoint survives LOADER_PATH being dropped. Both runtime stages inherit 
the entrypoint from runtime-base, and nothing else invokes the JAR (the only 
command: override in deploy/docker-compose.yml belongs to the mysql service).
    
    Confirmed end to end on a full deploy of 21d09842f with this patch: 
container healthy, actuator/health UP, authenticated /api/instances and 
/api/clusters return rows from MySQL.
---
 server/Dockerfile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/server/Dockerfile b/server/Dockerfile
index 4851ec150..208f95c31 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -93,7 +93,12 @@ RUN mkdir -p /app/lib \
 ENV LOADER_PATH=/app/lib
 
 EXPOSE 8888
-ENTRYPOINT ["java", "-jar", "app.jar"]
+# `java -jar` runs the fat JAR's Main-Class, which spring-boot-maven-plugin 
sets to JarLauncher, and
+# JarLauncher ignores LOADER_PATH — so the provided-scope connector downloaded 
above never reached the
+# classpath and the container died with "Cannot load driver class: 
com.mysql.cj.jdbc.Driver".
+# PropertiesLauncher is the launcher that honours loader.path, and it is 
already inside the JAR.
+ENTRYPOINT ["java", "-cp", "app.jar", "-Dloader.path=/app/lib", \
+            "org.springframework.boot.loader.launch.PropertiesLauncher"]
 
 # 
------------------------------------------------------------------------------
 # Stage 3a: runtime-prebuilt — deploy.sh target (JAR built on host)

Reply via email to