[druid-user] master node cannot load mysql driver, even we add connector into correct folder path

Hi all,

I have a problem when I start coordinator.
I have added “mysql-metadata-storage” into druid.extensions.loadList and add connecter into /extensions/mysql-metadata-storage.
We can see add successfully by below log, but also throw exception when startup coordinator which said cannot find driver in classpath.
How could I solve this problem? Thanks!!!

2022-06-16T11:55:24,280 INFO [main] org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.2.5.Final
2022-06-16T11:55:24,748 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-histogram], jars: druid-histogram-0.21.0.jar
2022-06-16T11:55:24,750 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-datasketches], jars: commons-math3-3.6.1.jar, druid-datasketches-0.21.0.jar
2022-06-16T11:55:24,750 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-lookups-cached-global], jars: mapdb-1.0.8.jar, druid-lookups-cached-global-0.21.0.jar, postgresql-42.2.14.jar
2022-06-16T11:55:24,751 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-s3-extensions], jars: druid-s3-extensions-0.21.0.jar
2022-06-16T11:55:24,752 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [mysql-metadata-storage], jars: mysql-metadata-storage-0.21.0.jar, mysql-connector-java-5.1.48.jar
2022-06-16T11:55:24,753 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-kafka-indexing-service], jars: lz4-java-1.7.1.jar, kafka-clients-2.7.0.jar, snappy-java-1.1.7.7.jar, zstd-jni-1.3.3-1.jar, druid-kafka-indexing-service-0.21.0.jar
2022-06-16T11:55:24,754 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-basic-security], jars: druid-basic-security-0.21.0.jar
2022-06-16T11:55:24,793 INFO [main] org.apache.druid.cli.CliCoordinator - Coordinator is configured to act as Overlord as well (druid.coordinator.asOverlord.enabled = true).
2022-06-16T11:55:24,891 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-histogram], jars: druid-histogram-0.21.0.jar
2022-06-16T11:55:24,893 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-datasketches], jars: commons-math3-3.6.1.jar, druid-datasketches-0.21.0.jar
2022-06-16T11:55:24,898 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-lookups-cached-global], jars: mapdb-1.0.8.jar, druid-lookups-cached-global-0.21.0.jar, postgresql-42.2.14.jar
2022-06-16T11:55:24,900 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-s3-extensions], jars: druid-s3-extensions-0.21.0.jar
2022-06-16T11:55:24,902 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [mysql-metadata-storage], jars: mysql-metadata-storage-0.21.0.jar, mysql-connector-java-5.1.48.jar
2022-06-16T11:55:24,904 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-kafka-indexing-service], jars: lz4-java-1.7.1.jar, kafka-clients-2.7.0.jar, snappy-java-1.1.7.7.jar, zstd-jni-1.3.3-1.jar, druid-kafka-indexing-service-0.21.0.jar
2022-06-16T11:55:24,905 INFO [main] org.apache.druid.initialization.Initialization - Loading extension [druid-basic-security], jars: druid-basic-security-0.21.0.jar
2022-06-16T11:55:25,652 INFO [main] org.apache.druid.guice.JsonConfigurator - Skipping druid.emitter.http.recipientBaseUrl property: one of it’s prefixes is also used as a property key. Prefix: druid
2022-06-16T11:55:25,652 INFO [main] org.apache.druid.guice.JsonConfigurator - Skipping druid.emitter.http.minHttpTimeoutMillis property: one of it’s prefixes is also used as a property key. Prefix: druid
2022-06-16T11:55:25,729 INFO [main] org.apache.curator.utils.Compatibility - Running in ZooKeeper 3.4.x compatibility mode
2022-06-16T11:55:25,730 INFO [main] org.apache.curator.utils.Compatibility - Using emulated InjectSessionExpiration
2022-06-16T11:55:26,069 INFO [main] org.apache.druid.server.emitter.EmitterModule - Using emitter [HttpPostEmitter{config=HttpEmitterConfig{flushMillis=60000, flushCount=500, flushTimeOut=9223372036854775807, basicAuthentication=‘null’, batchingStrategy=ARRAY, maxBatchSize=5242880, contentEncoding=null, batchQueueSizeLimit=50, httpTimeoutAllowanceFactor=2.0, minHttpTimeoutMillis=100, recipientBaseUrl=‘http://druid-exporter:8080/druid’}}] for metrics and alerts, with dimensions [{version=0.21.0}].

Exception in thread “main” 2022-06-16T19:55:26.090532618+08:00 java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:

  1. Error injecting constructor, org.apache.druid.java.util.common.ISE: Could not find com.mysql.jdbc.Driver on the classpath. The MySQL Connector library is not included in the Druid distribution but is required to use MySQL. Please download a compatible library (for example ‘mysql-connector-java-5.1.48.jar’) and place it under ‘extensions/mysql-metadata-storage/’. See Druid | Download for more details.
    at org.apache.druid.metadata.storage.mysql.MySQLConnector.(MySQLConnector.java:60)
    while locating org.apache.druid.metadata.storage.mysql.MySQLConnector
    at org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule.configure(MySQLMetadataStorageModule.java:78) (via modules: com.google.inject.util.Modules$OverrideModule → org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule)
    while locating org.apache.druid.metadata.MetadataStorageConnector annotated with @com.google.inject.multibindings.Element(setName=,uniqueId=197, type=MAPBINDER, keyType=java.lang.String)
    at org.apache.druid.guice.PolyBind.createChoiceWithDefault(PolyBind.java:109) (via modules: com.google.inject.util.Modules$OverrideModule → com.google.inject.util.Modules$OverrideModule → org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule)
    while locating org.apache.druid.metadata.MetadataStorageConnector
    for the 1st parameter of org.apache.druid.guice.JacksonConfigManagerModule.getConfigManager(JacksonConfigManagerModule.java:52)
    at org.apache.druid.guice.JacksonConfigManagerModule.getConfigManager(JacksonConfigManagerModule.java:52) (via modules: com.google.inject.util.Modules$OverrideModule → com.google.inject.util.Modules$OverrideModule → org.apache.druid.guice.JacksonConfigManagerModule)
    while locating org.apache.druid.common.config.ConfigManager
    for the 1st parameter of org.apache.druid.common.config.JacksonConfigManager.(JacksonConfigManager.java:49)
    at org.apache.druid.guice.JacksonConfigManagerModule.configure(JacksonConfigManagerModule.java:41) (via modules: com.google.inject.util.Modules$OverrideModule → com.google.inject.util.Modules$OverrideModule → org.apache.druid.guice.JacksonConfigManagerModule)
    while locating org.apache.druid.common.config.JacksonConfigManager
    for the 1st parameter of org.apache.druid.guice.JacksonConfigProvider.configure(JacksonConfigProvider.java:65)
    at org.apache.druid.guice.JacksonConfigProvider.bind(JacksonConfigProvider.java:38) (via modules: com.google.inject.util.Modules$OverrideModule → com.google.inject.util.Modules$OverrideModule → org.apache.druid.cli.CliOverlord$1)
    Caused by: org.apache.druid.java.util.common.ISE: Could not find com.mysql.jdbc.Driver on the classpath. The MySQL Connector library is not included in the Druid distribution but is required to use MySQL. Please download a compatible library (for example ‘mysql-connector-java-5.1.48.jar’) and place it under ‘extensions/mysql-metadata-storage/’. See Druid | Download for more details.
    at org.apache.druid.metadata.storage.mysql.MySQLConnector.(MySQLConnector.java:66)
    at org.apache.druid.metadata.storage.mysql.MySQLConnector$$FastClassByGuice$$4c602f87.newInstance()
    at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:104)
    at com.google.inject.spi.ProviderLookup$1.get(ProviderLookup.java:104)
    at com.google.inject.multibindings.MapBinder$RealMapBinder$ValueProvider.get(MapBinder.java:821)
    at org.apache.druid.guice.PolyBind$ConfiggedProvider.get(PolyBind.java:202)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ProviderMethod$Factory.provision(ProviderMethod.java:402)
    at com.google.inject.internal.ProviderMethod$Factory.get(ProviderMethod.java:376)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at org.apache.druid.guice.LifecycleScope$1.get(LifecycleScope.java:68)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:110)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:82)
    at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
    at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
    at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
    at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:223)
    at com.google.inject.internal.Initializer.injectAll(Initializer.java:132)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:174)
    at com.google.inject.internal.InternalInjectorCreator.build(Inter2022-06-16T19:55:26.090581179+08:00 nalInjectorCreator.java:110)
    at com.google.inject.Guice.createInjector(Guice.java:99)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at org.apache.druid.initialization.Initialization.makeInjectorWithModules(Initialization.java:433)
    at org.apache.druid.cli.GuiceRunnable.makeInjector(GuiceRunnable.java:69)
    at org.apache.druid.cli.ServerRunnable.run(ServerRunnable.java:62)
    at org.apache.druid.cli.Main.main(Main.java:113)
    Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.druid.metadata.storage.mysql.MySQLConnector.(MySQLConnector.java:63)
    … 60 more

Solved. Since connector without write permission.

Sheng Kai Lin 在 2022年6月18日 星期六上午9:48:13 [UTC+8] 的信中寫道:

1 Like