7 Replies Latest reply on Dec 3, 2007 3:34 AM by Nicolas Daudin

    [3.2.3] [NoClassDefFoundError] Weird exception although i ha

    Nicolas Daudin Newbie

      Hey there,
      I know, this subject has been treated already in this forum, but i did not find the answer to my problems.

      Here is the context.
      I am working on an .ear. So far, i was not packaging my librairies in my .ear, i used to put them directly in JBoss (in /server/default/lib).
      Now i have some problems with my app and i decided to clean all this mess. So i removed all the lib from my JBoss directory lib (/server/default/lib), then i downloaded a fresh JBoss 3.2.3 from the website, unzipped it and copied all the libs in /server/default/lib into my JBoss

      Now i am having some problems.
      My app is using Hibernate 2.x. Though i packaged the hibernate2.jar in my .ear, Jboss fails at deployment. So i added hibernate2.jar in server/default/lib. It still fails, but later in the code;)
      Here is the exception:

      2007-11-28 10:05:34,199 WARN [org.jboss.system.ServiceController] Problem starting service jboss.jca:service=HibernateFactory, name=HibernateFactory
      java.lang.NoClassDefFoundError: net/sf/hibernate/collection/List
       at net.sf.hibernate.type.TypeFactory.list(TypeFactory.java:186)
       at net.sf.hibernate.mapping.List.getCollectionType(List.java:19)
       at net.sf.hibernate.mapping.Collection.getType(Collection.java:275)
       at net.sf.hibernate.cfg.Binder.bindProperty(Binder.java:422)
       at net.sf.hibernate.cfg.Binder.createProperty(Binder.java:1041)
       at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1022)
       at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
       at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
       at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
       at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
       at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:304)
       at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:174)
       at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:145)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
       at $Proxy14.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:394)
       at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
       at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
       at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
       at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:394)
       at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
       at org.jboss.Main.boot(Main.java:150)
       at org.jboss.Main$1.run(Main.java:395)
       at java.lang.Thread.run(Thread.java:534)


      So as you can see, i get a NoClassDefFoundError on net.sf.hibernate.collection.List.
      BUT: i checked my hibernate2.jar in my JBoss libs, this class is present. I checked my hibernate2.jar in my .ear, the class is present.
      BESIDES: before throwing the exception, some hibernate classes are used (see calls to net.sf.hibernate.cfg.Binder.bindRoot, bindRootClass, createProperty...)

      Someone told me the error might come because the VM doesnt know which version of my net.sf.hibernate.collection.List class to use (since its present in two librairies). BUT, if i remove one of them, as soon as i start deploying my app, deployment fails at the very beginning saying a class is missing...

      HEEEELP!!