The moose likes Object Relational Mapping and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap" Watch "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap" New topic

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap

Keerthi Kumar
Ranch Hand

Joined: Apr 20, 2009
Posts: 105

I am new to Hibernate. Please help me to resolve the below mentioned error :

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap
at org.hibernate.util.SimpleMRUCache.init(
at org.hibernate.util.SimpleMRUCache.<init>(
at org.hibernate.util.SimpleMRUCache.<init>(
at org.hibernate.engine.query.QueryPlanCache.<init>(
at org.hibernate.impl.SessionFactoryImpl.<init>(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at com.Hibernate.Demo.FirstHibernateProgram.main(
package com.Hibernate.Demo;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class FirstHibernateProgram
public static void main(String[] args)
Session ses = null;
System.out.println("Im inside try block!!");
SessionFactory sessFact = null;
System.out.println("Im inside try block 2");
Configuration config = new Configuration();
System.out.println("Im inside try block 3");
sessFact = config.configure().buildSessionFactory();
System.out.println("Session Factory!!"+sessFact);
ses = sessFact.openSession();
System.out.println("inserting records into STUDENT tbl");
AdLeadDesignSite alds = new AdLeadDesignSite();
System.out.println("Records inserted !!");
catch(HibernateException e)

Keerthi Kumar N

Keerthi Kumar N
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3927

Keerthi Kumar wrote:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap

Are you sure that you included the classpath for the Commons Collections library.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
David Newton

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 137
You need to Common-collections.jar. This issue will be resolved.
Towid Khan

Joined: Apr 12, 2008
Posts: 8
Kumar was right!

I was having the same problem and now it is fixed.

QUESTION.. how did you find out the solution?? Google??
I agree. Here's the link:
subject: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap
It's not a secret anymore!