完整报错信息如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘agencySybaseSessionFactory’ defined in class path resource [spring/DAO.xml]: Invocation of init method failed; nested exception is org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [xxxxxxx] is not bound in this Context. Unable to find xxxx].
Caused by: org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [agy-hpsyb01-aidcconfig-utf8] is not bound in this Context. Unable to find [agy-hpsyb01-aidcconfig-utf8].
Caused by: javax.naming.NameNotFoundException: Name [xxxxxxxxx] is not bound in this Context. Unable to find [agy-hpsyb01-aidcconfig-utf8].
这是一个idea tomcatlocal 控制台的报错,最近新拉的项目,搭环境还是要熟悉这个项目的同事搭吧,找了一天多,没有解决,后来让同事解决了
这个报错大概是,创建 agencySybaseSessionFactory ben 失败,在spring/dao.xml文件里,找不到 xxxxx 这个上下文域
解决办法:
1.在本地tomcat conten.xml 文件里配置名为 xxxxxxx 的数据配置信息
2.确保 dao.xml能读取到这个这条 xxxxxxxx 配置
项目成功
配置文件里有个类爆红,其实可以不用理他,浪费了大量时间找jar包,也找不到这个类