jQuery in Action, 2nd edition*
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


Win a copy of Spring in Action this week in the Spring forum!
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
Author

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

Keerthi Kumar
Ranch Hand

Joined: Apr 20, 2009
Posts: 105
Hi,

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(SimpleMRUCache.java:71)
at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)
at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:50)
at org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:65)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at com.Hibernate.Demo.FirstHibernateProgram.main(FirstHibernateProgram.java:19)

FirstHibernateProgram.java
-------------------------------
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;
try
{
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();
alds.setDesignBundleSiteId(111111);
alds.setLeadDesignId(10321984);
alds.setLeadDesignId(22222);
alds.setDesignBundleId(232323);
ses.save(alds);
System.out.println("Records inserted !!");
}
catch(HibernateException e)
{
System.out.println(e.getMessage());
}
finally
{
//ses.flush();
//ses.close();
}
}
}

Thanks,
Keerthi Kumar N


Cheers,
Keerthi Kumar N
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3165
    
  47

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
Author
Rancher

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: 133
You need to Common-collections.jar. This issue will be resolved.
Towid Khan
Greenhorn

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: http://aspose.com/file-tools
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap