为了账号安全,请及时绑定邮箱和手机立即绑定

Spring事务管理, java.lang.ClassNotFoundException: org.springframework.core.DecoratingProxy

Spring事务管理, java.lang.ClassNotFoundException: org.springframework.core.DecoratingProxy

云雀 2016-09-04 22:24:17
2016-09-04 22:19:46,214 INFO  [AbstractApplicationContext.java:513] : Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@226a82c4: startup date [Sun Sep 04 22:19:46 CST 2016]; root of context hierarchy2016-09-04 22:19:46,298 INFO  [XmlBeanDefinitionReader.java:316] : Loading XML bean definitions from class path resource [applicationContext.xml]2016-09-04 22:19:46,617 INFO  [PropertiesLoaderSupport.java:172] : Loading properties file from class path resource [jdbc.properties]2016-09-04 22:19:46,664 INFO  [MLog.java:92] : MLog clients using log4j logging.2016-09-04 22:19:46,962 INFO  [C3P0Registry.java:216] : Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10]org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountServiceProxy' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/DecoratingProxy at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at base.UnitTestBase.before(UnitTestBase.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)Caused by: java.lang.NoClassDefFoundError: org/springframework/core/DecoratingProxy at org.springframework.aop.framework.AopProxyUtils.completeProxiedInterfaces(AopProxyUtils.java:121) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:120) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109) at org.springframework.aop.framework.AbstractSingletonProxyFactoryBean.afterPropertiesSet(AbstractSingletonProxyFactoryBean.java:178) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ... 36 moreCaused by: java.lang.ClassNotFoundException: org.springframework.core.DecoratingProxy at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 42 more
查看完整描述

1 回答

?
大咪

TA贡献785条经验 获得超332个赞

我怎么觉得有好几个错-按顺序的话,第一个错是你的Spring的配置文件xml没加载上……你把代码截图看看

查看完整回答
反对 回复 2016-09-05
  • 云雀
    云雀
    测试类 package com.sky.service.impl; import org.junit.Test; import com.sky.service.AccountService; import base.UnitTestBase; //@RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration("classpath:applicationContext.xml") public class AccountServiceImplTest extends UnitTestBase { //@Resource(name="accountService") //private AccountService accountService; public AccountServiceImplTest() { super("classpath:applicationContext.xml"); } @Test public void testTransfer() { AccountService accountService=super.getBean("accountServiceProxy"); accountService.transfer("aaa", "bbb", 100d); } }
  • 云雀
    云雀
    回复字数有1200的限制
  • 云雀
    云雀
    父类主要代码 public UnitTestBase(String springXmlpath) { this.springXmlpath = springXmlpath; } @Before public void before() { if (StringUtils.isEmpty(springXmlpath)) { this.springXmlpath = "classpath*:spring-*.xml"; } try { String[] spring = this.springXmlpath.split("[,\\s]+"); for (String str : spring) { System.out.println("xml address:"+str); } this.context = new ClassPathXmlApplicationContext(this.springXmlpath.split("[,\\s]+")); this.context.start(); } catch (BeansException e) { e.printStackTrace(); } } @After public void after() { this.context.destroy(); } @SuppressWarnings("unchecked") protected <T extends Object> T getBean(String beanId) { return (T) this.context.getBean(beanId); }
点击展开后面8
  • 1 回答
  • 0 关注
  • 5762 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信