Hi all,
I am trying to a run an application with Hibernate annotation. I am getting the following exception
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: net.sf.cglib.core.DebuggingClassWriter$1
Exception in thread "main" java.lang.ExceptionInInitializerError
at tapes.test.validation.SessionUtil.<clinit>(SessionUtil.java:17)
at java.lang.Class.initializeClass(libgcj.so.90)
at tapes.test.validation.LuceneSearch.dbFullIndex(LuceneSearch.java:34)
at tapes.test.validation.LuceneSearch.main(LuceneSearch.java:143)
Caused by: java.lang.NoClassDefFoundError: net.sf.cglib.core.DebuggingClassWriter$1
at java.lang.Class.initializeClass(libgcj.so.90)
at net.sf.cglib.core.DebuggingClassWriter.toByteArray(DebuggingClassWriter.java:73)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:26)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at java.lang.Class.initializeClass(libgcj.so.90)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at tapes.test.validation.SessionUtil.<clinit>(SessionUtil.java:14)
...3 more
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.util.TraceClassVisitor not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/local/tomcat/webapps/SearchDoctors/Webcontent/WEB-INF/classes/,file:/usr/local/tomcat/webapps/SearchDoctors/WEB-INF/lib/ant-1.6.5.jar,file:/usr/local/tomcat/webapps/SearchDoctors/WEB-INF/lib/ant-antlr-1.6.5.jar,file:/usr/local/tomcat/webapps/SearchDoctors/WEB-INF/lib/ant-junit-1.6.5.jar,file:/usr/local/tomcat/webapps/SearchDoctors/WEB-INF/lib/ant-launcher-.....
Here is the code.
public static void dbFullIndex() throws CorruptIndexException, LockObtainFailedException, IOException{
try{
directory = FSDirectory.getDirectory("/home/athreya/luceneindex/docsIndexFile");
//Index of the User Table--> /home/araghu/aditya/indexFile
Session session = SessionUtil.getSessionFactory().getCurrentSession();
if(IndexReader.indexExists(directory)){
writer = new IndexWriter(directory, new StandardAnalyzer(),true);
System.out.println("Index exists");
}
else{
writer = new IndexWriter(directory, new StandardAnalyzer(),true);
System.out.println("Index doesn't Exist");
}
session.beginTransaction();
org.hibernate.Query query = session.createQuery("from Doctors");
java.util.List docList = query.list();
session.getTransaction().commit();
for( int iter=0;iter< docList.size();iter++){
Doctors docs=(Doctors) docList.get(iter);
String pkid=docs.getId()+"";
String indexString= docs.getFirstName()+" "+docs.getMiddleName()+" "+docs.getLastName()+
" "+docs.getAddress()+" "+docs.getCity()+" "+docs.getHospitalNames()+" "+docs.getSpecialization()+" "
+docs.getQualification()+" "+docs.getNatProId();
//String specialString =docs.getSpecialization()+" "+docs.getHospitalNames();
writer.addDocument(createDoc(indexString,pkid));
System.out.println("Name ="+ docs.getFirstName());
// writer.addDocument(createSpDoc(specialString));
}
writer.close();
}catch(Exception e){
e.printStackTrace();
}
}
Can anyone please explain me the problem. I have the cglib jar in place in the lib. my java_home is set as follows --- export JAVA_HOME=/usr/jdk1.6.0_18/
Please Help I'm struggling with this for a long time.
Thanks, Aditya