Spring Framework
  1. Spring Framework
  2. SPR-10206

IllegalAccessError with load time weaving enabled.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1.3
    • Fix Version/s: Waiting for Triage
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      I have an application with multiple web modules with the spring dependencies at the ear level. I am trying to use load time weaving with Spring's caching abstraction. When I deploy my application I get the following:

      [2013-01-21 08:51:59,877] ERROR: [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] org.springframework.web.context.ContextLoader - Context initialization failed
      org.springframework.beans.factory.CannotLoadBeanCl assException: Error loading class [org.springframework.integration.config.FilterFacto ryBean] for bean with name 'org.springframework.integration.config.FilterFact oryBean#0' defined in null: problem with class file or dependent class; nested exception is java.lang.IllegalAccessError: class org.springframework.integration.config.FilterFacto ryBean cannot access its superclass org.springframework.integration.config.AbstractSta ndardMessageHandlerFactoryBean
      at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:1265)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.predictBeanType(Abstrac tAutowireCapableBeanFactory.java:576)
      at org.springframework.beans.factory.support.Abstract BeanFactory.isFactoryBean(AbstractBeanFactory.java :1331)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.doGetBeanNamesForType(DefaultLi stableBeanFactory.java:337)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanNamesForType(DefaultList ableBeanFactory.java:308)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanNamesForType(DefaultList ableBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBean(DefaultListableBeanFact ory.java:257)
      at org.springframework.security.saml.SAMLBootstrap.po stProcessBeanFactory(SAMLBootstrap.java:46)
      at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:687)
      at org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:677)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:454)
      at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:383)
      at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:283)
      at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 111)
      at weblogic.servlet.internal.EventsManager$FireContex tListenerAction.run(EventsManager.java:481)
      at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:120)
      at weblogic.servlet.internal.EventsManager.notifyCont extCreatedEvent(EventsManager.java:181)
      at weblogic.servlet.internal.WebAppServletContext.pre loadResources(WebAppServletContext.java:1872)
      at weblogic.servlet.internal.WebAppServletContext.sta rt(WebAppServletContext.java:3153)
      at weblogic.servlet.internal.WebAppModule.startContex ts(WebAppModule.java:1508)
      at weblogic.servlet.internal.WebAppModule.start(WebAp pModule.java:482)
      at weblogic.application.internal.flow.ModuleStateDriv er$3.next(ModuleStateDriver.java:425)
      at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:52)
      at weblogic.application.internal.flow.ModuleStateDriv er.start(ModuleStateDriver.java:119)
      at weblogic.application.internal.flow.ScopedModuleDri ver.start(ScopedModuleDriver.java:200)
      at weblogic.application.internal.flow.ModuleListenerI nvoker.start(ModuleListenerInvoker.java:247)
      at weblogic.application.internal.flow.ModuleStateDriv er$3.next(ModuleStateDriver.java:425)
      at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:52)
      at weblogic.application.internal.flow.ModuleStateDriv er.start(ModuleStateDriver.java:119)
      at weblogic.application.internal.flow.StartModulesFlo w.activate(StartModulesFlow.java:27)
      at weblogic.application.internal.BaseDeployment$2.nex t(BaseDeployment.java:636)
      at weblogic.application.utils.StateMachineDriver.next State(StateMachineDriver.java:52)
      at weblogic.application.internal.BaseDeployment.activ ate(BaseDeployment.java:205)
      at weblogic.application.internal.EarDeployment.activa te(EarDeployment.java:58)
      at weblogic.application.internal.DeploymentStateCheck er.activate(DeploymentStateChecker.java:161)
      at weblogic.deploy.internal.targetserver.AppContainer Invoker.activate(AppContainerInvoker.java:79)
      at weblogic.deploy.internal.targetserver.BasicDeploym ent.activate(BasicDeployment.java:184)
      at weblogic.deploy.internal.targetserver.BasicDeploym ent.activateFromServerLifecycle(BasicDeployment.ja va:361)
      at weblogic.management.deploy.internal.DeploymentAdap ter$1.doActivate(DeploymentAdapter.java:51)
      at weblogic.management.deploy.internal.DeploymentAdap ter.activate(DeploymentAdapter.java:200)
      at weblogic.management.deploy.internal.AppTransition$ 2.transitionApp(AppTransition.java:30)
      at weblogic.management.deploy.internal.ConfiguredDepl oyments.transitionApps(ConfiguredDeployments.java: 240)
      at weblogic.management.deploy.internal.ConfiguredDepl oyments.activate(ConfiguredDeployments.java:169)
      at weblogic.management.deploy.internal.ConfiguredDepl oyments.deploy(ConfiguredDeployments.java:123)
      at weblogic.management.deploy.internal.DeploymentServ erService.resume(DeploymentServerService.java:180)
      at weblogic.management.deploy.internal.DeploymentServ erService.start(DeploymentServerService.java:96)
      at weblogic.t3.srvr.SubsystemRequest.run(SubsystemReq uest.java:64)
      at weblogic.work.ExecuteThread.execute(ExecuteThread. java:207)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java :176)
      Caused by: java.lang.IllegalAccessError: class org.springframework.integration.config.FilterFacto ryBean cannot access its superclass org.springframework.integration.config.AbstractSta ndardMessageHandlerFactoryBean
      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.lang.ClassLoader.defineClass(ClassLoader.java :465)
      at org.springframework.context.support.ContextTypeMat chClassLoader$ContextOverridingClassLoader.loadCla ssForOverriding(ContextTypeMatchClassLoader.java:1 09)
      at org.springframework.core.OverridingClassLoader.loa dClass(OverridingClassLoader.java:61)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
      at org.springframework.context.support.ContextTypeMat chClassLoader.loadClass(ContextTypeMatchClassLoade r.java:63)
      at org.springframework.util.ClassUtils.forName(ClassU tils.java:258)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doResolveBeanClass(AbstractBeanFactory .java:1280)
      at org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:1254)
      ... 49 more
      

      This does not happen with load time weaving off. I see right beforehand that ServiceActivatorFactoryBean is loaded which loads the AbstractStandardMessageHandlerFactoryBean from the ear level classloader. When FilterFactoryBean is trying to be loaded up through the temporary ContextTypeMatchClassLoader classloader, I think it doesn't like getting the bytes without the same ProtectionDomain as the classes in the parent classloader, but I'm not sure. I've verified that that parent classloaders for the load of ServiceActivatorFactoryBean and FilterFactoryBean are the same.

      Right before the IllegalAccessError, I see a loadClass for PrivilegedActionException being called from JNI (from defineClass native method), which I'm guessing some how gets translated into an IllegalAccessError.

      Any ideas?

      I temporarily worked around this by modifying org.springframework.core.OverridingClassLoader to include the package of FilterFactoryBean in public static final String[] DEFAULT_EXCLUDED_PACKAGES. This is not ideal as I do not want to have to modify spring code. I can't set this programmatically using reflection as you cannot modify a static final field even with setAccessible(true).

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Juergen Hoeller
            Reporter:
            Maxim Moldenhauer
            Last updater:
            Phil Webb
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since last comment:
              1 year, 13 weeks, 1 day ago