栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

java.lang.SecurityException: setContextClassLoader

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

java.lang.SecurityException: setContextClassLoader

报错:

java.lang.SecurityException: setContextClassLoader
        at java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader(ForkJoinWorkerThread.java:244)
        at org.postgresql.util.SharedTimer.getTimer(SharedTimer.java:48)
        at org.postgresql.jdbc.PgConnection.getTimer(PgConnection.java:1225)
        at org.postgresql.jdbc.PgConnection.addTimerTask(PgConnection.java:1239)
        at org.postgresql.jdbc.PgStatement.startTimer(PgStatement.java:981)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:472)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
        at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
        at org.postgresql.jdbc.PgConnection.isValid(PgConnection.java:1432)

说明原因:

引入pgjdbc相关包,与mongo数据库共用时,出现问题  

处理方法:

CompletableFuture.supplyAsync(()->{},dbExecutor.executor());

return CompletableFuture.supplyAsync(()->{
  Graph graph = jongo.getCollection(TransConstant.work_graph)
      .findOne(new ObjectId(id)).as(Graph.class);//mongo查询
  if (graph != null) {
    RiskGraph2Dto dto = new RiskGraph2Dto();
  dto.setNodes3(graphDomain.getNodeLayers(id));//pg查询
  dto.setEdges3(graphDomain.getEdgeLayers(id));//pg查询
    return dto;
  }
  return null;
},dbExecutor.executor());

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/531418.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号