Self-revolution opened a new issue, #6760: URL: https://github.com/apache/incubator-seata/issues/6760
### Ⅰ. Issue Description 启动`apache/seata-server:2.1.0.jre17`镜像时,无法加载mysql驱动,我尝试将`mysql-connector-java-8.0.30.jar`和`mysql-connector-j-8.4.0.jar`挂载到/lib/jdbc目录下,但还是报错 ### Ⅱ. Describe what happened 启动脚本: ``` docker run -d \ --net=host \ --restart=always \ --name=seata \ -v "$directory"/application.yml:/seata-server/resources/application.yml \ -v "$directory"/logs:/root/logs/seata \ -v "$directory"/mysql-connector-java-8.0.30.jar:/lib/jdbc/mysql-connector-java.jar \ -e SEATA_IP=192.168.88.171 \ -e SEATA_PORT=8091 \ -e TZ=Asia/Shanghai \ apache/seata-server:2.1.0.jre17 ``` 报错内容: ``` 00:47:05.841 WARN --- [ main] [letWebServerApplicationContext] [ refresh] [] : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'branchSessionController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'branchSessionDBServiceImpl' defined in file [/seata-server/classes/org/apache/seata/server/console/impl/db/BranchSessionDBServiceImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.seata.server.console.impl.db.BranchSessionDBServiceImpl$$EnhancerBySpringCGLIB$$7af44348]: Constructor threw exception; nested exception is org.apache.seata.common.loader.EnhancedServiceNotFoundException: not found service provider for : org.apache.seata. core.store.db.DataSourceProvider caused by java.lang.IllegalStateException: Extension instance(definition: org.apache.seata.common.loader.ExtensionDefinition@b24fb6c2, class: interface org.apache.seata.core.store.db.DataSourceProvider) could not be instantiated: the {com.mysql.cj.jdbc.Driver} can't be found in the path /lib/jdbc/, please copy database driver dependencies, such as `mysql-connector-java.jar` to the path. at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.createNewExtension(EnhancedServiceLoader.java:495) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.getExtensionInstance(EnhancedServiceLoader.java:478) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.loadExtension(EnhancedServiceLoader.java:453) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.load(EnhancedServiceLoader.java:347) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.access$200(EnhancedServiceLoader.java:278) at org.apache.seata.common.loader.EnhancedServiceLoader.load(EnhancedServiceLoader.java:116) at org.apache.seata.common.loader.EnhancedServiceLoader.load(EnhancedServiceLoader.java:101) at org.apache.seata.server.console.impl.db.BranchSessionDBServiceImpl.<init>(BranchSessionDBServiceImpl.java:71) at org.apache.seata.server.console.impl.db.BranchSessionDBServiceImpl$$EnhancerBySpringCGLIB$$7af44348.<init>(<generated>) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:544) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:520) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:673) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:228) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:329) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:921) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) at org.apache.seata.server.ServerApplication.main(ServerApplication.java:30) Caused by: org.apache.seata.common.exception.StoreException: the {com.mysql.cj.jdbc.Driver} can't be found in the path /lib/jdbc/, please copy database driver dependencies, such as `mysql-connector-java.jar` to the path. at org.apache.seata.core.store.db.AbstractDataSourceProvider.validate(AbstractDataSourceProvider.java:103) at org.apache.seata.core.store.db.AbstractDataSourceProvider.generate(AbstractDataSourceProvider.java:84) at org.apache.seata.core.store.db.AbstractDataSourceProvider.init(AbstractDataSourceProvider.java:75) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.initInstance(EnhancedServiceLoader.java:707) at org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader.createNewExtension(EnhancedServiceLoader.java:492) ... 49 more ``` 我将版本修改为seataio/seata-server:1.8.0.jre17,进入镜像后,可以看到我的脚本确实可以将驱动jar包挂载到/lib/jdbc目录下 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org