Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-13095

CGLIB code generation failure for [email protected] FactoryBean call

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 4.2 RC1
    • Fix Version/s: 4.2 RC2
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.concurrent.ExecutorService]: Factory method 'casCheckExecutor' threw exception; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalArgumentException-->Protected method: getDefaultThreadNamePrefix()Ljava/lang/String;
      	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
      	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
      	... 67 more
      Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalArgumentException-->Protected method: getDefaultThreadNamePrefix()Ljava/lang/String;
      	at org.springframework.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
      	at org.springframework.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
      	at org.springframework.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
      	at org.springframework.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:643)
      	at org.springframework.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
      	at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
      	at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
      	at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285)
      	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.enhanceFactoryBean(ConfigurationClassEnhancer.java:402)
      	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:295)
      	at com.marketnews.scrollers.security.SecurityConfig$$EnhancerBySpringCGLIB$$4d2a9eb1.casCheckExecutorFactoryBean(<generated>)
      	at com.marketnews.dbsso.spring.AbstractCASWebSecurityConfigurerAdapter.casCheckExecutor(AbstractCASWebSecurityConfigurerAdapter.java:318)
      	at com.marketnews.scrollers.security.SecurityConfig$$EnhancerBySpringCGLIB$$4d2a9eb1.CGLIB$casCheckExecutor$17(<generated>)
      	at com.marketnews.scrollers.security.SecurityConfig$$EnhancerBySpringCGLIB$$4d2a9eb1$$FastClassBySpringCGLIB$$433a316a.invoke(<generated>)
      	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
      	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
      	at com.marketnews.scrollers.security.SecurityConfig$$EnhancerBySpringCGLIB$$4d2a9eb1.casCheckExecutor(<generated>)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
      	... 68 more
      Caused by: java.lang.IllegalArgumentException: Protected method: getDefaultThreadNamePrefix()Ljava/lang/String;
      	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:209)
      	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor$1.intercept(ConfigurationClassEnhancer.java:399)
      	at org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean$$EnhancerBySpringCGLIB$$93e65b95.getDefaultThreadNamePrefix(<generated>)
      	at org.springframework.util.CustomizableThreadCreator.<init>(CustomizableThreadCreator.java:51)
      	at org.springframework.scheduling.concurrent.CustomizableThreadFactory.<init>(CustomizableThreadFactory.java:42)
      	at org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.<init>(ExecutorConfigurationSupport.java:45)
      	at org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean.<init>(ThreadPoolExecutorFactoryBean.java:53)
      	at org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean$$EnhancerBySpringCGLIB$$93e65b95.<init>(<generated>)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at org.springframework.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
      	... 89 more
      

      Related code is this:

      	@Bean
      	public ThreadPoolExecutorFactoryBean casCheckExecutorFactoryBean() throws Exception {
      		ThreadPoolExecutorFactoryBean threadPoolExecutorFactoryBean = new ThreadPoolExecutorFactoryBean();
      		threadPoolExecutorFactoryBean.setCorePoolSize(Runtime.getRuntime().availableProcessors() * 2);
      		threadPoolExecutorFactoryBean.setQueueCapacity(Integer.MAX_VALUE);
      		threadPoolExecutorFactoryBean.setThreadNamePrefix("casCheckExecutor-");
      		return threadPoolExecutorFactoryBean;
      	}
      
      	@Bean(name="casCheckExecutor")
      	public ExecutorService casCheckExecutor() throws Exception {
      		return casCheckExecutorFactoryBean().getObject();
      	}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                gdelprete Gabriele Del Prete
                Last updater:
                St├ęphane Nicoll
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 24 weeks, 6 days ago