Sunday, 12 January 2014

Initial Session factory createion Errororg/apache/commons/collections/SequencedHashMap


If you getting bellow exception while executing project. Reason behind this add Apache Commons Collections jar in your lib folder either add maven dependency in pom.xml :-


 commons-collections
 commons-collections
 3.2.1



Initial Session factory createion Errororg/apache/commons/collections/SequencedHashMap
Exception in thread "main" java.lang.ExceptionInInitializerError
 at com.javastoreroom.session.config.HibernateUtils.(HibernateUtils.java:16)
 at com.javastoreroom.dao.PropertiesDAOImpl.persistContent(PropertiesDAOImpl.java:17)
 at com.javastoreroom.properties.Main.ReadProperties.main(ReadProperties.java:24)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
 at org.hibernate.mapping.Table.(Table.java:33)
 at org.hibernate.cfg.Mappings.addTable(Mappings.java:165)
 at org.hibernate.cfg.annotations.TableBinder.fillTable(TableBinder.java:145)
 at org.hibernate.cfg.annotations.EntityBinder.bindTable(EntityBinder.java:410)
 at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:553)
 at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
 at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
 at com.insonix.session.config.HibernateUtils.(HibernateUtils.java:12)
 ... 2 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.SequencedHashMap
 at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 ... 12 more

:)