白云影中仙 2021-09-16 11:22 采纳率: 50%
浏览 100

急, SSM框架,数据处理之后向数据库插入出现问题,本地测试没有问题,上线后没有走插入sql,走完数据处理直接不进行了,日志也没有报错!

insert语句:


<insert id="insertSelective" parameterType="SiteStat">
        insert into linkCrawler.site_stat(website_name,series_url_sum,episode_url_sum,series_match,series_sys_match,
                                          series_verified,series_vdna_verified,series_matched_vdna,series_mapping_table,
                                          series_hav_episode,series_output_episode,episode_matched,episode_linking_host,
                                          hosting_extracted,hosting_output,hosting_online,hosting_online_episode,
                                          mapping_synced,hybrid_url,cyberlocker_url,lsr_url)
        values (#{website_name},#{series_url_sum},#{episode_url_sum},#{series_match},#{series_sys_match},
                #{series_verified},#{series_vdna_verified},#{series_matched_vdna},#{series_mapping_table},
                #{series_hav_episode},#{series_output_episode}………………

相关数据查询处理:


ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        siteServiceImpl series = (siteServiceImpl) context.getBean("siteServiceImpl");

我是通过这种方式绑定xml然后执行sql
之后通过下面的这种方式去取值然后计算之后,将其存入map中

        Map<Object,Object> seriesSum = new HashMap<>();
//遍历list,从里面拿websitename 对比
        for (Object l : list) {
            /**
             * site,siteMapper,siteMapper.xml   都是seriesURL相关的
             */
            for (int i = 0; i < series.getSiteList().size(); i++) {
                if (series.getSiteList().get(i).getWebsiteName().equals(l)) {
                    //seriesURL 总数计算
                    Seriescount += series.getSiteList().get(i).getSeriesSum();
                    seriesSum.put(series.getSiteList().get(i).getWebsiteName(), Seriescount);
}
}

插入的话是遍历seriesSum将其插入addUrl中,然后插入数据库,是一条一条执行插入的

        Map<String,Object> addUrl = new HashMap<>();

for(Map.Entry<Object, Object> en:seriesSum.entrySet()){
           addUrl.put("series_url_sum",en.getValue());
            }

经过测试,本地是完全可以正常运行并插入本地数据库的,但是打包上线之后,走完数据处理没有走执行,有日志打印信息

数据处理之前:
        logger.info("Start data handler!!!!");

执行插入语句之前
        logger.info("Start Insert SiteStat !!!");

然后本地日志输出:

[DEBUG][2021-09-16 10:38:26][v.dao.EpisodeMapper]Cache Hit Ratio [v.dao.EpisodeMapper]: 0.9999447696896057
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@22d46cc]
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6e7430aa] was not registered for synchronization because synchronization is not active
[DEBUG][2021-09-16 10:38:26][v.dao.EpisodeMapper]Cache Hit Ratio [vobile.dao.EpisodeMapper]: 0.9999447712147571
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6e7430aa]

[INFO][2021-09-16 10:38:26][v.utils.SiteStatUtils]Start Insert SiteStat !!!
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6c281bd1] was not registered for synchronization because synchronization is not active
[DEBUG][2021-09-16 10:38:26][com.mchange.v2.resourcepool.BasicResourcePool]trace com.mchange.v2.resourcepool.BasicResourcePool@87bbdf8 [managed: 2, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@783bc5f0)
[DEBUG][2021-09-16 10:38:26][org.mybatis.spring.transaction.SpringManagedTransaction]JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@551bfe75 [wrapping: com.mysql.cj.jdbc.ConnectionImpl@2151eb44]] will not be managed by Spring
[DEBUG][2021-09-16 10:38:26][v.dao.SiteStatMapper.insertSelective]==>  Preparing: insert into linkCrawler.site_stat(website_name,

部署上线的日志输出:

[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bef11b3] was not registered for synchronization because synchronization is not active
[DEBUG][21-09-15][v.dao.EpisodeMapper]Cache Hit Ratio [v.dao.EpisodeMapper]: 0.9999825391559428
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bef11b3]
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5baf2c52] was not registered for synchronization because synchronization is not active
[DEBUG][21-09-15][v.dao.EpisodeMapper]Cache Hit Ratio [v.dao.EpisodeMapper]: 0.999982539308382
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5baf2c52]
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@345e2b9a] was not registered for synchronization because synchronization is not active
[DEBUG][21-09-15][v.dao.EpisodeMapper]Cache Hit Ratio [v.dao.EpisodeMapper]: 0.9999825394608185
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@345e2b9a]
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Creating a new SqlSession
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@12e629d4] was not registered for synchronization because synchronization is not active
[DEBUG][21-09-15][v.dao.EpisodeMapper]Cache Hit Ratio [vobile.dao.EpisodeMapper]: 0.9999825396132525
[DEBUG][21-09-15][org.mybatis.spring.SqlSessionUtils]Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@12e629d4]
[DEBUG][21-09-15][com.mchange.v2.async.ThreadPoolAsynchronousRunner]com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7a9c4071 -- Running DeadlockDetector[Exiting. No pending tasks.]
[DEBUG][21-09-15][com.mchange.v2.async.ThreadPoolAsynchronousRunner]com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3d1c1fd1 -- Running DeadlockDetector[Exiting. No pending tasks.]
[DEBUG][21-09-15][com.mchange.v2.async.ThreadPoolAsynchronousRunner]com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@7a9c4071 -- Running DeadlockDetector[Exiting. No pending tasks.]

**也没有打印出执行的info
也不报错 ,不知道问题出在哪
一脸懵逼,求解!
**

另外附上xml文件(没有用到前端的东西,后续应该会加所以直接SSM了):

img

img

mybatis-config.xml

img

spring-dao.xml

img

spring-mvc.xml

img

spring-service.xml

img

求解!

  • 写回答

1条回答 默认 最新

  • 编号灬9527 2021-09-16 11:36
    关注

    你搞个远程debug看看就得了

    评论

报告相同问题?

问题事件

  • 创建了问题 9月16日

悬赏问题

  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥15 pyqt信号槽连接写法
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急