连接池未注册org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'XXX'

代码之前一直好好的,写了一个定时器后报错,本地测试为了立马能执行就用cron表达式* * * * * ?,为了只执行一次在最后面加上Thread.sleep(1000*3600*24)睡眠二十四小时从而达到每次测试只执行一次定时任务。

    @Scheduled(cron="* * * * * ?")
    public void execute() throws InterruptedException {
            System.out.println("调用时间"+CommonTool.getNowDateStr());
            insert();
            Thread.sleep(1000*3600*24);
    }

启动报错org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias ‘XXX’

《连接池未注册org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'XXX'》

我的原因是在于连接池没注册号就调用了dao层导致报错,但是只会在刚启动时报一次。只需要在调用dao之前Thread.sleep(10000)线程睡眠十秒等到线程池注册成功在进行dao操作。

 

点赞

Leave a Reply

Your email address will not be published. Required fields are marked *