org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [c
2017-02-28 12:44
4375 查看
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'forumService': FactoryBean threw
exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class
[class java.lang.String]: Common causes of this problem include using a final class or a non-visible class; nested exception is
java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1443)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at com.dhcc.advice.TestIntroduction.main(TestIntroduction.java:31)
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class java.lang.String]:
Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException:
Cannot subclass final class class java.lang.String
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:217)
at org.springframework.aop.framework.ProxyFactoryBean.getProxy(ProxyFactoryBean.java:362)
at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:316)
at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:242)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 6 more
Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String
at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)
... 10 more
这就是 sting value="forumSrviceTarget" 报错,这里,不能用value要用ref
Could not generate CGLIB subclass of class [class java.lang.String]
exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class
[class java.lang.String]: Common causes of this problem include using a final class or a non-visible class; nested exception is
java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1443)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at com.dhcc.advice.TestIntroduction.main(TestIntroduction.java:31)
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class java.lang.String]:
Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException:
Cannot subclass final class class java.lang.String
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:217)
at org.springframework.aop.framework.ProxyFactoryBean.getProxy(ProxyFactoryBean.java:362)
at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:316)
at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:242)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 6 more
Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String
at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)
... 10 more
这就是 sting value="forumSrviceTarget" 报错,这里,不能用value要用ref
Could not generate CGLIB subclass of class [class java.lang.String]
<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="pmonitor" class="com.baobaotao.introduce.ControllablePerformaceMonitor" /> <bean id="forumServiceTarget" class="com.baobaotao.introduce.ForumService" /> <bean id="forumService" class="org.springframework.aop.framework.ProxyFactoryBean" > <property name="interfaces" value="com.baobaotao.introduce.Monitorable"></property> <!-- <property name="target" value="forumServiceTarget"></property> --> <!-- 注意这里是ref而不是 value --> <property name="target" value="forumServiceTarget"></property> <property name="interceptorNames" value="pmonitor"></property> <property name="proxyTargetClass" value="true"></property> </bean> </beans>
相关文章推荐
- Could not load org/springframework/beans/factory/config/Scope.class. java.util.zip.ZipException: inv
- java.lang.ClassNotFoundException: org.springframework.aop.TargetSource
- java.lang.ClassNotFoundException: org.springframework.aop.TargetSource
- Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.in
- Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy22]
- Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigExcep
- tomcat : Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException:
- Could not generate CGLIB subclass of class编译时出错
- Could not generate CGLIB subclass of class[class XXXX]:
- Could not generate CGLIB subclass of class[class X
- org.springframework.aop.framework.AopConfigException: Cannot proxy target class
- Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
- 【ssh学习笔记】struts处理json异常之JSONWriter can not access a member of class org.springframework.aop.TruePoin
- 解决 java.lang.ClassNotFoundException: org.springframework.beans.factory.config.EmbeddedValueResolver
- org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons
- ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 问题原因。
- org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query;
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value