• 【春到渭南】随手拍渭南各地区春景,一贴看尽渭南春色! 2019-04-18
  • 新能源汽车纳入蚌埠市级政府集中采购目录 2019-04-17
  • 马克思的每个人全面而自由发展,是人的最高需求层次理论。 2019-04-13
  • 习近平:在2018年春节团拜会上的讲话 2019-04-13
  • 陕煤集团多家分公司5月煤炭铁路装运量创历史新高 2019-03-25
  • 中国公民可72小时免签停留俄大城市?中俄正在协商 2019-03-21
  • 就是,适可而止,太多就太假了。[哈哈] 2019-03-21
  • 海螺集团党委组织召开今年第五次中心组学习会 2019-03-17
  • 哈洽会华南城分会场暨俄罗斯风情文化节启幕 2019-03-17
  • 什么是幸福 ——“幸福死了”与“健康长寿” 2019-03-08
  • 高级需求不是物质需求,而是精神需求。你可能理解不了,为什么方志敏们面对高官,厚禄的诱惑而其志不改。 2019-03-08
  • 让办证群众跑十几趟 宁都这黄所长“黄”了 2019-03-05
  • 毛泽东说帝国主义都是纸老虎。是有社会基础的 2019-02-25
  • springboot+druid+mybatis+mysql启动报错,请高手帮助

    关注 发布于 03/16 17:18
    阅读 146
    收藏 0

    广东十一选五推荐号 www.qhysp.com spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
    spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xx?serverTimezone=utc&characterEncoding=utf8&useUnicode=true&useSSL=false
    spring.datasource.username=xxx
    spring.datasource.password=xxx
    spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
    spring.datasource.initialSize=5
    spring.datasource.minIdle=5
    spring.datasource.maxActive=20
    spring.datasource.maxWait=60000
    spring.datasource.filters=stat,wall
    spring.datasource.timeBetweenEvictionRunsMillis=60000
    spring.datasource.minEvictableIdleTimeMillis=300000
    spring.datasource.validationQuery=select 'x'
    spring.datasource.testWhileIdle=true
    spring.datasource.testOnBorrow=false
    spring.datasource.testOnReturn=false
    spring.datasource.poolPreparedStatements=true
    spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
    spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
    spring.druidLoginName=admin
    spring.druidPassword=admin

     

    @Bean
        public SqlSessionFactoryBean sqlSessionFactory(DruidDataSource datasource){
            SqlSessionFactoryBean bean=new SqlSessionFactoryBean();
            datasource.setInitialSize(initialSize);
            datasource.setMinIdle(minIdle);
            datasource.setMaxActive(maxActive);
            datasource.setMaxWait(maxWait);
            datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);    
            datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);    
            datasource.setValidationQuery(validationQuery);
            datasource.setTestWhileIdle(testWhileIdle);
            datasource.setTestOnBorrow(testOnBorrow);
            datasource.setTestOnReturn(testOnReturn);   
            datasource.setPoolPreparedStatements(poolPreparedStatements);    
            datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);    
            try {
                datasource.setFilters(filters);
            } catch (SQLException e) {
                e.printStackTrace();
            }
            datasource.setConnectionProperties(connectionProperties);
            bean.setDataSource(datasource);
            return bean;
        }
        
        @Bean
        public SqlSessionTemplate sqlSession(SqlSessionFactoryBean sqlSessionFactory){
            SqlSessionTemplate bean=null;
            try {
                bean = new SqlSessionTemplate(sqlSessionFactory.getObject());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return bean;
        }

     

    报错如下:

    [2019-03-16 17:14:38] ERROR org.springframework.boot.SpringApplication - Application run failed
    java.util.ConcurrentModificationException: null
        at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
        at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:742)
        at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:810)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
        at net.hb.xuelebaoapp.config.MainApplication.main(MainApplication.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
    [2019-03-16 17:14:38] INFO  org.apache.catalina.loader.WebappClassLoaderBase - Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.MySQLConnection]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.MySQLConnection]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1363)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1351)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:820)
        at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.findClassIgnoringNotFound(TomcatEmbeddedWebappClassLoader.java:121)
        at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.doLoadClass(TomcatEmbeddedWebappClassLoader.java:86)
        at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:68)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1173)
        at com.alibaba.druid.util.Utils.loadClass(Utils.java:220)
        at com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker.<init>(MySqlValidConnectionChecker.java:50)
        at com.alibaba.druid.pool.DruidDataSource.initValidConnectionChecker(DruidDataSource.java:1231)
        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:885)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1300)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1296)
        at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:109)
        at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157)
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
        at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
        at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)
        at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:338)
        at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84)
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:108)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
        at com.sun.proxy.$Proxy96.query(Unknown Source)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
        at com.sun.proxy.$Proxy93.selectList(Unknown Source)
        at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:222)
        at net.hb.xuelebaoapp.system.dao.impl.FredaDaoImpl.queryForList(FredaDaoImpl.java:105)
        at net.hb.xuelebaoapp.manager.sys.service.impl.ParamServiceImpl.list(ParamServiceImpl.java:41)
        at net.hb.xuelebaoapp.system.listener.SystemInitListener$launchSPMonitor.run(SystemInitListener.java:82)
        at java.lang.Thread.run(Thread.java:748)
    [2019-03-16 17:14:39] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
    [2019-03-16 17:14:39] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed

     

    通过换mysql驱动包和druid驱动包版本,试了都不行

    加载中
    0
    w
    wailouci
    列表循环中增减元素了?
    0
    关注
    关注

    什么意思??

    0
    关注
    关注

    请大神帮助看看

    返回顶部
    顶部
  • 【春到渭南】随手拍渭南各地区春景,一贴看尽渭南春色! 2019-04-18
  • 新能源汽车纳入蚌埠市级政府集中采购目录 2019-04-17
  • 马克思的每个人全面而自由发展,是人的最高需求层次理论。 2019-04-13
  • 习近平:在2018年春节团拜会上的讲话 2019-04-13
  • 陕煤集团多家分公司5月煤炭铁路装运量创历史新高 2019-03-25
  • 中国公民可72小时免签停留俄大城市?中俄正在协商 2019-03-21
  • 就是,适可而止,太多就太假了。[哈哈] 2019-03-21
  • 海螺集团党委组织召开今年第五次中心组学习会 2019-03-17
  • 哈洽会华南城分会场暨俄罗斯风情文化节启幕 2019-03-17
  • 什么是幸福 ——“幸福死了”与“健康长寿” 2019-03-08
  • 高级需求不是物质需求,而是精神需求。你可能理解不了,为什么方志敏们面对高官,厚禄的诱惑而其志不改。 2019-03-08
  • 让办证群众跑十几趟 宁都这黄所长“黄”了 2019-03-05
  • 毛泽东说帝国主义都是纸老虎。是有社会基础的 2019-02-25