【发布时间】:2011-03-29 07:50:06
【问题描述】:
我正在运行我的 JunitTest,它给出了以下错误.. 不是失败。
在类路径资源 [LT.xml] 中定义名称为“reportDAO”的 bean 创建错误: 设置 bean 属性“hibernateTemplate”时无法解析对 bean“hibernateTemplate”的引用; 嵌套异常是 org.springframework.beans.factory.BeanCreationException: 在类路径资源 [LT.xml] 中定义名称为“hibernateTemplate”的 bean 创建错误: 设置 bean 属性“sessionFactory”时无法解析对 bean“sessionFactory”的引用; 嵌套异常是 org.springframework.beans.factory.BeanCreationException: 在类路径资源 [LT.xml] 中定义名称为“sessionFactory”的 bean 创建错误: 调用 init 方法失败;嵌套异常是 org.hibernate.MappingException: 关联引用未映射的类:dfi.fin.dcm.syn.loantrading.model.engine.result.BDTSTest 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1210) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:978) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404) 在 java.security.AccessController.doPrivileged(本机方法) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375) 在 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263) 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430) 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) 在 org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:199) 在 org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:179) 在 org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:158) 在 org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:105) 在 org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:87) 在 junit.framework.TestCase.runBare(TestCase.java:128) 在 org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) 在 junit.framework.TestResult$1.protect(TestResult.java:106) 在 junit.framework.TestResult.runProtected(TestResult.java:124) 在 junit.framework.TestResult.run(TestResult.java:109) 在 junit.framework.TestCase.run(TestCase.java:120) 在 junit.framework.TestSuite.runTest(TestSuite.java:230) 在 junit.framework.TestSuite.run(TestSuite.java:225) 在 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) 在 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)我检查了我各自的 xml 文件,所有引用都存在于这些 xml 文件中,我找不到问题出在哪里。有什么想法吗?
【问题讨论】:
标签: java hibernate spring junit