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了):
mybatis-config.xml
spring-dao.xml
spring-mvc.xml
spring-service.xml
求解!