spring boot 连接Phoenix 报错SYSTEM:CATALOG is found but client

错误详情:

18:19:14.527 [taskScheduler-1] ERROR o.s.s.s.TaskUtils$LoggingErrorHandler - Unexpected error occurred in scheduled task.
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (ERROR 726 (43M10):  Inconsistent namespace mapping properties.. Cannot initiate connection as SYSTEM:CATALOG is found but client does not have phoenix.schema.isNamespaceMappingEnabled enabled)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:390)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:470)
spring.main.show_banner=false
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:480)
at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:506)
at com.yixia.bigdata.smartbi.service.ExporterTaskService.getRunningTaskList(ExporterTaskService.java:197)
at com.yixia.bigdata.smartbi.service.ExporterTaskService.checkTasks(ExporterTaskService.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (ERROR 726 (43M10):  Inconsistent namespace mapping properties.. Cannot initiate connection as SYSTEM:CATALOG is found but client does not have phoenix.schema.isNamespaceMappingEnabled enabled)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 19 common frames omitted
  • 解决方案:

    在spring boot 配置文件中新增如下配置:

      spring.datasource.connectionProperties=phoenix.schema.isNamespaceMappingEnabled=true
    
  • 参考资料

    1. https://stackoverflow.com/questions/34856811/how-to-set-custom-connection-properties-on-datasource-in-spring-boot-1-3-x-with
    
    2. http://blog.csdn.net/haoyouai2015/article/details/78621659
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Spring Boot单元测试报错"Failed to load ApplicationContext"时,通常是因为无法加载应用程序的上下文。 该错误可能是由多种原因引起的。首先,检查测试类的注解是否正确。通常,一个正常的Spring Boot单元测试类应该使用`@SpringBootTest`和`@RunWith(SpringRunner.class)`这两个注解。如果测试类中缺少这些注解,可能会导致无法加载应用程序上下文。 其次,检查`@SpringBootTest`注解中的配置选项是否正确。可以尝试添加`webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT`来确保在测试过程中可以使用随机端口。这可以避免端口冲突的问题。 另外,还可以检查项目的依赖是否正确配置。如果缺少必要的依赖,也可能会导致无法加载应用程序的上下文。 最后,还可以查看具体的错误信息,它可能提供了更多关于错误原因的线索。例如,检查是否存在缺少的配置文件或类路径错误等问题。 总结起来,当出现"Failed to load ApplicationContext"错误时,需要检查测试类的注解配置是否正确,同时还要确保项目的依赖正确配置,并查看具体的错误信息以获取更多线索。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Springboot 单元测试 报错 java.lang.IllegalStateException: Failed to load ApplicationContext](https://blog.csdn.net/weixin_45944993/article/details/119761092)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值