Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoClassDefFoundError Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NoClassDefFoundError

    I get a NoClassDefFound Error when trying to deploy a web-app with spring-1.1 into jboss-3.2.6. The aopalliance.jar is in the lib directory of my .war.

    StackTrace:


    10:31:35,792 INFO [TomcatDeployer] undeploy, ctxPath=/sitegenerator, warUrl=file:/usr/local/jboss/server/default/tmp/deploy/tmp16152sitegenerator.war/
    10:31:36,928 INFO [TomcatDeployer] deploy, ctxPath=/sitegenerator, warUrl=file:/usr/local/jboss/server/default/tmp/deploy/tmp16153sitegenerator.war/
    10:31:37,974 INFO [Engine] StandardContext[/sitegenerator]Loading root WebApplicationContext
    10:31:38,188 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from resource [/WEB-INF/web-application-context.xml] of ServletContext
    10:31:38,495 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'sectionServiceTransactionInterceptor' defined in resource [/WEB-INF/web-application-context.xml] of ServletContext: Class that bean class [org.springframework.transaction.interceptor.Transa ctionInterceptor] depends on not found; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/AspectException
    java.lang.NoClassDefFoundError: org/aopalliance/aop/AspectException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:219)
    at org.springframework.beans.factory.support.BeanDefi nitionReaderUtils.createBeanDefinition(BeanDefinit ionReaderUtils.java:50)
    at org.springframework.beans.factory.xml.DefaultXmlBe anDefinitionParser.parseBeanDefinition(DefaultXmlB eanDefinitionParser.java:303)
    at org.springframework.beans.factory.xml.DefaultXmlBe anDefinitionParser.parseBeanDefinition(DefaultXmlB eanDefinitionParser.java:263)
    at org.springframework.beans.factory.xml.DefaultXmlBe anDefinitionParser.registerBeanDefinition(DefaultX mlBeanDefinitionParser.java:229)
    at org.springframework.beans.factory.xml.DefaultXmlBe anDefinitionParser.registerBeanDefinitions(Default XmlBeanDefinitionParser.java:180)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:164)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:128)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:124)
    at org.springframework.context.support.AbstractXmlApp licationContext.refreshBeanFactory(AbstractXmlAppl icationContext.java:64)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:239)
    at org.springframework.web.context.support.XmlWebAppl icationContext.refresh(XmlWebApplicationContext.ja va:131)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:156)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:97)
    at org.springframework.web.context.ContextLoaderServl et.init(ContextLoaderServlet.java:80)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:211)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1029)
    at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:862)
    at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4013)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4357)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:823)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:807)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.modeler.BaseModelMBean.invoke(B aseModelMBean.java:503)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:149)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.apache.catalina.core.StandardContext.init(Stan dardContext.java:5441)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.modeler.BaseModelMBean.invoke(B aseModelMBean.java:503)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:149)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDep loyInternal(TomcatDeployer.java:316)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDep loy(TomcatDeployer.java:76)
    at org.jboss.web.AbstractWebDeployer.start(AbstractWe bDeployer.java:320)
    at org.jboss.web.WebModule.startModule(WebModule.java :62)
    at org.jboss.web.WebModule.startService(WebModule.jav a:40)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Start(ServiceMBeanSupport.java:271)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Lifecycle(ServiceMBeanSupport.java:221)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(R eflectedDispatcher.java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:62)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:54)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:82)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:197)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.jboss.system.ServiceController$ServiceProxy.in voke(ServiceController.java:884)
    at $Proxy18.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceCo ntroller.java:414)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(R eflectedDispatcher.java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:62)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:54)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:82)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:197)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:176)
    at $Proxy35.start(Unknown Source)
    at org.jboss.web.AbstractWebContainer.start(AbstractW ebContainer.java:363)
    at org.jboss.deployment.MainDeployer.start(MainDeploy er.java:829)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:641)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:604)
    at sun.reflect.GeneratedMethodAccessor14.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(R eflectedDispatcher.java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:62)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:54)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:82)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:197)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:176)
    at $Proxy8.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner. deploy(URLDeploymentScanner.java:304)
    at org.jboss.deployment.scanner.URLDeploymentScanner. scan(URLDeploymentScanner.java:460)
    at org.jboss.deployment.scanner.AbstractDeploymentSca nner$ScannerThread.doScan(AbstractDeploymentScanne r.java:201)
    at org.jboss.deployment.scanner.AbstractDeploymentSca nner$ScannerThread.loop(AbstractDeploymentScanner. java:212)
    at org.jboss.deployment.scanner.AbstractDeploymentSca nner$ScannerThread.run(AbstractDeploymentScanner.j ava:191)

    Any help would be greatly appreciated

    Regards
    Andy Barnes

  • #2
    Could you try deploying on 3.2.5. If the problem doesn't show with 3.2.5 it probably has to do with a different CGLIB version that's present in the server/default/lib directory. JBoss 3.2.6 ships with cglib 2.0.1, Spring uses 2.0.2... CGlib is neede by the hibernate support that comes with Jboss since 3.2.6. REmoving the jars (Hibernate, CGLib) should be enough I hope.

    Alef

    Comment


    • #3
      Hi Alef

      Thanks for your reply. I actually noticed the older CGLIB jar and swapped it for 2.02, but it didn't fix the problem. I also removed another application that uses Spring, because it was being deployed first with older versions (haven't updated it yet).

      I turned classloading debugging on and found it was trying to load the package org.aopalliance.reflection, which is not in the latest jar and since this app is the only one deployed in this server I started looking for another aopalliance.jar file in ${jboss_dir}/lib and ${jboss_dir}/server/default/lib, but I couldn't find one.

      To cut a long story short I fixed the problem by un-jarring the aopalliance.jar and copying the classes to the WEB-INF/classes directory

      Would someone with more jboss knowledge than me know where else aopalliance could be being used.

      Regards
      Andy Barnes

      Comment


      • #4
        I'm using JBoss 4.0.0 with the aopalliance jar no probs.

        I'm not at my other dev box now but seem to remember that i've got it in myapp.ear/lib, and referenced in the (evil?) J2EE application.xml via a java module

        e.g.

        <module>
        <web> ... etc
        </module>

        <module>
        <java>lib/aop/aopalliance.jar</java>
        </module>

        Are you able to try JBoss 4.0.0 or the java module option? If not, let me know and I can poke around to confirm what i've done.

        I think class loading was improved in 4.x vs 3.2.x so if you can, try doing a search on the specifics and you may want to upgrade.

        Comment

        Working...
        X