Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-45870

cglib 2.2 is not compatible with asm 4 or superior (it causes sharding doesn't work)

    Details

      Description

      After upgrading to asm 5.0.1 in LPS-45591 we can't create aspects like this:

      <aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardIterativelyAdvice" pointcut="execution(void com.liferay.portal.events.StartupHelper.verifyProcess(boolean))" />
      

      This causes, for example, that portal can't be initialized using sharding, it prints the following exception:

      11:29:01,248 INFO  [pool-2-thread-1][ShardDataSourceTargetSource:87] Sharding configured with 3 data sources
      11:29:16,984 ERROR [pool-2-thread-1][ContextLoader:206] Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelperUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.events.StartupHelper#22cf71b7' of type [com.liferay.portal.events.StartupHelper] while setting bean property 'startupHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelper#22cf71b7' defined in class path resource [META-INF/util-spring.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      	at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:236)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelper#22cf71b7' defined in class path resource [META-INF/util-spring.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:526)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
      	... 30 more
      Caused by: java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2836)
      	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
      	at net.sf.cglib.core.AbstractClassGenerator.<init>(AbstractClassGenerator.java:38)
      	at net.sf.cglib.core.KeyFactory$Generator.<init>(KeyFactory.java:127)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
      	at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
      	at org.springframework.aop.framework.Cglib2AopProxy.createEnhancer(Cglib2AopProxy.java:228)
      	at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:170)
      	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:476)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:406)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1428)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
      	... 32 more
      Apr 10, 2014 11:29:16 AM org.apache.catalina.core.StandardContext listenerStart
      SEVERE: Exception sending context initialized event to listener instance of class com.liferay.portal.spring.context.PortalContextLoaderListener
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelperUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.events.StartupHelper#22cf71b7' of type [com.liferay.portal.events.StartupHelper] while setting bean property 'startupHelper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelper#22cf71b7' defined in class path resource [META-INF/util-spring.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
      	at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:236)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.events.StartupHelper#22cf71b7' defined in class path resource [META-INF/util-spring.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:526)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
      	... 30 more
      Caused by: java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2836)
      	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1668)
      	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
      	at net.sf.cglib.core.AbstractClassGenerator.<init>(AbstractClassGenerator.java:38)
      	at net.sf.cglib.core.KeyFactory$Generator.<init>(KeyFactory.java:127)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
      	at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
      	at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
      	at org.springframework.aop.framework.Cglib2AopProxy.createEnhancer(Cglib2AopProxy.java:228)
      	at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:170)
      	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:476)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
      	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:406)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1428)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
      	... 32 more
      

      Steps to reproduce
      1- Start the portal using sharding

      The portal won't startup properly and it will print the previous exception.

      Workaround
      Use the previous jar files of asm (version 3.3) which we were using (I have attached them):

      • asm.jar
      • asm-analysis.jar
      • asm-commons.jar
      • asm-tree.jar
      • asm-util.jar
      • asm-xml.jar

      in WEB-INF/lib and remove asm-debug-all.jar file from that directory.

        Attachments

        1. asm-xml.jar
          48 kB
        2. asm-util.jar
          36 kB
        3. asm-tree.jar
          21 kB
        4. asm-commons.jar
          37 kB
        5. asm-analysis.jar
          18 kB
        6. asm.jar
          43 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 24 weeks ago

                  Packages

                  Version Package
                  7.0.0 M1