Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4501
268
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to Common-collections.jar. This issue will be resolved.
 
Towid Khan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar was right!

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

QUESTION.. how did you find out the solution?? Google??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic