baomidou / dynamic-datasource

dynamic datasource for springboot 多数据源 动态数据源 主从分离 读写分离 分布式事务
https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611
Apache License 2.0
4.74k stars 1.19k forks source link

How can i use tomcat? #46

Closed DoyuTu closed 5 years ago

DoyuTu commented 5 years ago

Enviroment

Windows10 + Maven3 + Tomcat9.0.16 + MySQL5.7 DatasourceType: com.zaxxer.hikari.HikariDataSource DriverClassName: com.mysql.cj.jdbc.Driver JDK Version(required): v1.8 SpringBoot Version(required): v2.1.4 Starter Version(required): v2.5.3

Describe

I used Tomcat to deploy the WAR package without using and introducing the Alibaba/Druid data source, but problems like this still occurred when starting:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration': Unsatisfied dependency expressed through field 'properties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource.dynamic-com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/alibaba/druid/wall/WallConfig

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration': Unsatisfied dependency expressed through field 'properties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource.dynamic-com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/alibaba/druid/wall/WallConfig

(note: everything is fine with SpringBoot's built-in Web container)

Expected Result: Up and running Actual Result:
Start the error

Steps to reproduce

huayanYu commented 5 years ago

等待2.5.4