Springboot 1.3 jndi报错, 信息如下, 有没有哪位遇到过?

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [comp/env/jdbc/facts_slave] is not bound in this Context. Unable to find [comp].
### The error may exist in com/logic/system/persistence/read/SystemConfigurationReadMapper.xml
### The error may involve com.logic.system.persistence.read.SystemConfigurationReadMapper.selectByPrimaryKey
### The error occurred while executing a query
### Cause: org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [comp/env/jdbc/facts_slave] is not bound in this Context. Unable to find [comp].
        at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) ~[mybatis-spring-1.2.2.jar!/:1.2.2]
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) ~[mybatis-spring-1.2.2.jar!/:1.2.2]
        at com.sun.proxy.$Proxy69.selectOne(Unknown Source) ~[na:na]
        at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163) ~[mybatis-spring-1.2.2.jar!/:1.2.2]
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68) ~[mybatis-3.2.7.jar!/:3.2.7]
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar!/:3.2.7]
        at com.sun.proxy.$Proxy135.selectByPrimaryKey(Unknown Source) ~[na:na]
        at com.logic.system.models.configuration.service.SystemConfigurationService.get(SystemConfigurationService.java:125) ~[system-server-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT]
        at com.logic.yinkunserver.models.dingxin.service.CollectionDayDataService.doCollection(CollectionDayDataService.java:72) ~[system-server-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT]
毫无头绪.... 配置文件如下:
logic:
  jndi:
    master:
      name: jdbc/facts_master
      factory: org.apache.commons.dbcp2.BasicDataSourceFactory
      maxActive: 5
      maxIdle: 2
      initialSize: 1
      maxWait: 5000
      test-on-borrow: true
      validation-query: select 1
    slave:
      name: jdbc/facts_slave
      factory: org.apache.commons.dbcp2.BasicDataSourceFactory
      maxActive: 5
      maxIdle: 2
      initialSize: 1
      maxWait: 5000
      test-on-borrow: true
      validation-query: select 1
阅读 4.2k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题