8 Replies Latest reply on Feb 11, 2014 9:09 AM by user12679330

    java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem

    user12679330

      Hi,

       

      we have upgraded from weblogic 10g server to weblogic 11g server, as part of that we are encountering the below issue in one of the webapplication which uses spring(3.0) files. this application is succefully deployed in 10g with

       

      <dependency>

         <groupId>org.aspectj</groupId>

         <artifactId>aspectjrt</artifactId>

         <version>1.6.9</version>

        </dependency>

        <dependency>

         <groupId>org.aspectj</groupId>

         <artifactId>aspectjweaver</artifactId>

         <version>1.6.9</version>

        </dependency>

       

      But the same war is failing in 11g server. I have built using the latest aspectjrt and aspecrjweaver jar version with 1.7.4, but still the same error, please advice how can I get rid of this issue?

       

      when trying to start the webapplication in console getting the below error. You quick reply is much appreciated.

       

      weblogic.application.ModuleException: [HTTP:101216]Servlet: "rest" failed to preload on startup in Web application: "Webapplication.war".

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'plsAspect' defined in ServletContext resource [/WEB-INF/aspect-config.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:405)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)

              at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)

              at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)

              at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)

              at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)

              at javax.servlet.GenericServlet.init(GenericServlet.java:241)

              at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)

              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

              at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

              at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)

              at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)

              at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)

              at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)

              at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1983)

              at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1957)

              at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1876)

              at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3163)

              at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1522)

              at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)

              at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

              at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

              at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

              at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)

              at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)

              at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

              at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

              at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

              at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)

              at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)

              at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

              at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)

              at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)

              at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)

              at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)

              at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)

              at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)

              at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)

              at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:149)

              at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)

              at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)

              at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)

              at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)

              at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)

              at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)

              at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)

              at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)

              at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:531)

              at weblogic.work.ExecuteThread.execute(ExecuteThread.java:252)

              at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

      Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem

              at org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.isAspect(AbstractAspectJAdvisorFactory.java:120)

              at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.isInfrastructureClass(AnnotationAwareAspectJAutoProxyCreator.java:98)

              at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.isInfrastructureClass(AbstractAutoProxyCreator.java:381)

              at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:281)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:791)

        • 1. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
          Jeets-Oracle

          This could be a class loading issue.

           

          Probable thinks to check:

           

          1. Clear all the cache and tmp

          2. Restart the environment.

          3. Check the class path again.(To be insured)

          4. Use  <prefer-web-inf-classes>true</prefer-web-inf-classes> in weblogic.xml and give a try(Important)

           

          Thanks,

          • 2. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
            Vijaya_OCP_Moderator-Oracle


            Add the dependency library under WEB-INF/lib folder "aspectjweaver-1.6.6.jar" 


            Reconfigure the application .ear/.war file to add/update weblogic deployment files as below:

             

            1. application .war file

             

            WEB-INF\weblogic.xml

             

            <container-descriptor>
               <prefer-web-inf-classes>true</prefer-web-inf-classes>
            </container-descriptor>



             

            2. application .ear file

             

            META-INF\application.xml

             

            <display-name>application name</display-name>
            <module>
               <web>
                  <web-uri>application .war file</web-uri>
                  <context-root>application context root</context-root>
               </web>
            </module>

             

            META-INF\weblogic-application.xml

             

            <prefer-application-packages>
               <package-name>org.springframework.*</package-name>
            </prefer-application-packages>


            Hope this helps!!




            Thanks,

            Vijaya

            • 3. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
              user12679330

              Hi,

               

              Thanks for the quick reply.

              we tried and verified first 3 options, no change, I see in both the aspect jar's same class is present, I have tried this way too by deleting the same class from one of the jar, still getting the same error. About your 4th point, it's a web application (.war) file, this is how it was deployed on the 10g server too, now we can't change it to a ear file as a standard followup as is from 10g to 11g upgrade.

               

               

              Vijaya,

               

              we dont have any of those files in WEB-INF.

               

              only these files are there in WEB-INF

              aspect-config.xml

              repository-config.xml

              rest-servlet.xml

              web.xml

               

              and in META-INF

               

              MANIFEST.MF

               

              which has only version and no class path is added in it, by default takes from the lib directory.

               

              Thanks again.

              • 4. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
                user12679330

                Hi,

                 

                Any update pls.

                 

                Same error on another web application deployment too. these war files are deployed successfully before in weblogic 10 g servers. Is there any thing we need to add for 11g server deployments particularly?

                 

                <[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <000ebb84090d3f7d:4c50ab91:143e7056d90:-8000-0000000000001ada> <1392103607550> <BEA-149078> <Stack trace for message 149004

                weblogic.application.ModuleException:

                        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1524)

                        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)

                        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

                        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)

                        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)

                        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

                        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)

                        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)

                        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)

                        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)

                        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)

                        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)

                        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)

                        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)

                        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:149)

                        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)

                        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)

                        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:531)

                        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:252)

                        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

                Caused By: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem

                        at org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.isAspect(AbstractAspectJAdvisorFactory.java:120)

                        at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.isInfrastructureClass(AnnotationAwareAspectJAutoProxyCreator.java:98)

                        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.isInfrastructureClass(AbstractAutoProxyCreator.java:381)

                        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:281)

                        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:791)

                        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:762)

                        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:399)

                        at java.security.AccessController.doPrivileged(Native Method)

                        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

                        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

                        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

                        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

                        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

                        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)

                        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)

                        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)

                        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)

                        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)

                        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)

                        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

                        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

                        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)

                        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1870)

                        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3163)

                        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1522)

                        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)

                        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

                        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)

                        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)

                        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)

                        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)

                        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)

                        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)

                        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)

                        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)

                        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)

                        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)

                        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:573)

                        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)

                        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)

                        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:149)

                        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:327)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)

                        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)

                        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)

                        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)

                        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:531)

                        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:252)

                        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

                >

                • 5. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
                  Jeets-Oracle

                  Create one file weblogic.xml

                  WEB-INF\weblogic.xml

                   

                  <container-descriptor>
                     <prefer-web-inf-classes>true</prefer-web-inf-classes>
                  </container-descriptor>

                   

                  And do as suggested above, this would help resolving it. this is basically a class loading issue.

                   

                  Making as suggested above, would make application to use the .jar bundled along with .war.

                  • 6. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
                    Vijaya_OCP_Moderator-Oracle

                    you can try packaging the dependency library under WEB-INF/lib folder to overcome the class not found issues.

                     

                    If you end up with class cast issues or conflicts with other spring libraries , then you can try enabling  the options suggested in my previous update.

                     

                    Please try and let us know the update.

                     

                    The below option is just to inform the classloader to give preference to the classes loaded by application classloader under web-inf/lib

                    <prefer-web-inf-classes>true</prefer-web-inf-classes>

                     

                    Hope this clarifies!!

                     

                    regards,

                    Vijaya

                    1 person found this helpful
                    • 7. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
                      user12679330

                      Thank you.

                       

                      As mentioned in my first post, all the required jars are under the WEB-INF/lib directory.

                       

                      Ok I have created the weblogic.xml file under WEB-INF and created the war, will deploy it and let you know how that behaves now in 11g server.

                       

                      Thanks.

                      • 8. Re: java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem
                        user12679330

                        Thanks a lot to both of you.. It worked !!!.