java.sql.SQLException: There is no DataSource named ‘null‘

这篇具有很好参考价值的文章主要介绍了java.sql.SQLException: There is no DataSource named ‘null‘。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错信息

当配置dataSource后,即使配置文件中已经指定了JobStoreTX,实际还是使用LocalDataSourceJobStore。

2023-07-10 11:15:51,636 WARN  [main] org.quartz.impl.jdbcjobstore.JobStoreSupport: Database connection shutdown unsuccessful.
 java.sql.SQLException: There is no DataSource named 'null'
	at org.quartz.utils.DBConnectionManager.shutdown(DBConnectionManager.java:135)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.shutdown(JobStoreSupport.java:746)
	at org.quartz.core.QuartzScheduler.shutdown(QuartzScheduler.java:732)
	at org.quartz.impl.StdSchedulerFactory.shutdownFromInstantiateException(StdSchedulerFactory.java:1431)
	at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1391)
	at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1579)
	at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:679)
	at org.springframework.scheduling.quartz.SchedulerFactoryBean.prepareScheduler(SchedulerFactoryBean.java:616)
	at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:504)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at com.ym.learn.test.TestApplication.main(TestApplication.java:21)

application.yml配置

spring:
  application:
    name: learn-test
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
  main:
    allow-circular-references: true # 循环应用
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/learn-spring?serverTimezone=UTC&userUnicode=true&useSSL=false
    username: root
    password: 123456
  quartz:
    job-store-type: jdbc # quartz任务存储类型:jdbc或memory
    wait-for-jobs-to-complete-on-shutdown: true # 关闭时等待任务完成
    overwrite-existing-jobs: true # 可以覆盖已有的任务
    auto-startup: true
    properties: # quartz原生配置
      org:
        quartz:
          scheduler:
            instanceName: scheduler # 调度器实例名称
            instanceId: AUTO # 调度器实例ID自动生成
          jobStore:
            class: org.quartz.impl.jdbcjobstore.JobStoreTX # 调度信息存储处理类
            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # 使用完全兼容JDBC的驱动
            tablePrefix: QRTZ_ # quartz相关表前缀
            useProperties: false # 是否将JobDataMap中的属性转为字符串存储
          threadPool:
            class: org.quartz.simpl.SimpleThreadPool # 指定线程池实现类,对调度器提供固定大小的线程池
            threadCount: 10 # 设置并发线程数量
            threadPriority: 5 # 指定线程优先级

修改之处如下:文章来源地址https://www.toymoban.com/news/detail-548979.html

jobStore:
   class: org.springframework.scheduling.quartz.LocalDataSourceJobStore # 调度信息存储处理类

到了这里,关于java.sql.SQLException: There is no DataSource named ‘null‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 解决There is no PasswordEncoder mapped for the id “null“问题

    springsecurity从4.2升级到5.0之后,做简单的登录,出现如下所示的错误: 根据官方文档的资料和网上解决办法,需要做一些修改。 默认情况下与4.2版本不同的是,springsecurity5.0密码加密方式采用了bcrypt的方式,而且密码直接配置在xml文件中,不光是需要使用BCryptPasswordEncoder来加

    2023年04月09日
    浏览(93)
  • 【MySQL异常】解决java.sql.SQLException: null, message from server: “Host xxx‘ is not allowed to connect to

    Spring Boot + MySQL 本机访问MySQL数据库正常(即使用 localhost 或者 127.0.0.1 两种方式)。局域网内同事的电脑访问我电脑的数据库结果报错。用户使用的是root用户,即超管账户。 查看防火墙设置,是否允许远程访问mysql数据库这个程序。经查看本机确实限制了不允许远程访问msy

    2024年02月04日
    浏览(47)
  • 处理 Code:516. Authentication failed: password is incorrect or there is no user with such name.

     在测试 ClickHouse 分布式表时,创建分布式表成功,但是查询数据时报错,如下: Received exception from server (version 22.2.2): Code: 516. DB::Exception: Received from 192.168.38.101:9000. DB::Exception: Received from 192.168.38.103:9000. DB::Exception: default: Authentication failed: pass word is incorrect or there is no user w

    2024年02月17日
    浏览(44)
  • 数据库报错 Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied

    如果你也是用Java连接数据库的可以尝试看看 第一种类型 如果是MySQL8.0以上的,需要在后面加上 如果是这种的错误类型的,可以试试 第二种类型 数据库没有设置开放权限,不给连接,这种情况就算是使用连接数据库工具也没办法连接的。解决方式如下 第三种类型 这种如果是

    2024年01月24日
    浏览(92)
  • Mybatis报错:There is no getter for property named ‘xxx‘ in ‘class xxx 的解决办法

    在mybatis中遇到这样的报错,There is no getter for property named ‘xxx’ in \\\'class xxx ,这篇博客给出了解决办法。 There is no getter for property named ‘username’ in ‘class com.zxy.pojo.User’ 最先想着是不是User实体类没有写 Getter and Setter 方法,可是发现写了。 发现数据库表字段 category_id 与实体

    2024年02月03日
    浏览(55)
  • 记录mybatis插件奇怪报错问题There is no getter for property named ‘delegate‘ in ‘class com.sun.proxy.$Proxy的排查

    一、背景描述 项目要求update/delete必须要有where条件(因为出了一次生产上把一张表的数据全表删除的严重生产事故),并且要打印出where中的条件,所以考虑用mybatis拦截器处理 mybatis拦截器实现原理简述 在Mybatis中,拦截器可拦截如上图中四种相关操作类的操作方法。通过阅读源

    2024年01月16日
    浏览(52)
  • nested exception is java.sql.SQLException: connection disabled

    在使用Spring Boot连接数据库时,有时候会遇到\\\"nested exception is java.sql.SQLException: connection disabled\\\"异常。这个异常通常是由以下原因引起的: 数据库连接配置错误:检查数据库连接的URL、用户名和密码是否正确配置。确保URL中包含正确的数据库名称,并且用户名和密码与数据库中

    2024年02月12日
    浏览(44)
  • java.sql.SQLException: No value specified for parameter 1错误

    在Java中连接数据库并执行查询时,出现\\\"java.sql.SQLException: No value specified for parameter 1\\\"错误通常表示您在执行参数化查询时,没有为查询中的第一个参数提供值。这可能是由于以下几个原因引起的: 1. 参数顺序不正确:如果您在查询中使用了参数占位符(如\\\"?\\\"),则确保您为每

    2024年02月16日
    浏览(53)
  • Exception in thread “main“ java.sql.SQLException: No suitable driver

    详细报错信息如下: Exception in thread \\\"main\\\" java.sql.SQLException: No suitable driver     at java.sql.DriverManager.getDriver(DriverManager.java:315)     at org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions.$anonfun$driverClass$2(JDBCOptions.scala:107)     at scala.Option.getOrElse(Option.scala:189)     at org.apache.spark.sq

    2024年02月07日
    浏览(56)
  • Failed to obtain JDBC Connection; nested exception is java.sql.SQLException

    Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The server time zone value \\\'�й���׼ʱ��\\\' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the \\\'serverTimezone\\\' configuration property) to use a more specifc time zone value if you want to utilize time zone s

    2024年02月11日
    浏览(55)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包