-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: IllegalAccessError and NoClassDefFoundError
PostPosted: Thu Aug 19, 2004 12:47 am 
Newbie

Joined: Wed Aug 18, 2004 11:24 am
Posts: 2
MyCode:
try {
Configuration cfg = new Configuration().addClass(Employee.class);
SessionFactory sessions = cfg.buildSessionFactory(); // error here
new SchemaExport(cfg).create(true, true);
Session session = sessions.openSession();
} catch (Throwable ex) {
logger.debug("buildSessionFactory failed: " + ex);
throw new ExceptionInInitializerError(ex);
}

I really don't know why this happen.

When I first call the method:
Caused by: java.lang.ExceptionInInitializerError
at org.interactive.interactive.business.test.CompileTestMgrEJB.testHibernate(CompileTestMgrEJB.java:89)
at org.interactive.interactive.business.test.CompileTestMgr_bfazjd_EOImpl.testHibernate(CompileTestMgr_bfazjd_EOImpl.java:45)
... 24 more
Caused by: java.lang.IllegalAccessError
at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:47)
at net.sf.cglib.core.ClassEmitter.<init>(ClassEmitter.java:39)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
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.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:236)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at org.interactive.interactive.business.test.CompileTestMgrEJB.testHibernate(CompileTestMgrEJB.java:84)
... 25 more

After first call:
Caused by: java.lang.ExceptionInInitializerError
at org.interactive.interactive.business.test.CompileTestMgrEJB.testHibernate(CompileTestMgrEJB.java:89)
at org.interactive.interactive.business.test.CompileTestMgr_bfazjd_EOImpl.testHibernate(CompileTestMgr_bfazjd_EOImpl.java:45)
... 24 more
Caused by: java.lang.NoClassDefFoundError
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at org.interactive.interactive.business.test.CompileTestMgrEJB.testHibernate(CompileTestMgrEJB.java:84)
... 25 more


<hibernate-configuration>
<session-factory name="java:/hibernate/HibernateFactory">
<property name="show_sql">true</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/sale</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- <mapping resource="hibernatemaps/sale/Employee.hbm.xml" /> -->
<mapping resource="org/interactive/interactive/integration/sale/entity/Employee.hbm.xml" />
</session-factory>
</hibernate-configuration>

<hibernate-mapping>
<class name="org.interactive.interactive.integration.sale.entity.Employee" table="Employee">
<id name="employeeId" column="employee_id" type="long">
<generator class="assigned" />
</id>
<property name="name" column="name" />
<property name="password" column="password" />
</class>
</hibernate-mapping>

package org.interactive.interactive.integration.sale.entity;
public class Employee {
private Long employeeId;
private String name;
private String password;
get..
set...
}

Thanks for your help!

Hibernate version:
2.1.6
Name and version of the database you are using:
MySQL


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 7:00 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
This is version conflict, probably you use "new" cglib with "old" ASM libray.
Download latest cglib bundled with ASM (http://prdownloads.sourceforge.net/cglib/cglib-full-2.0.2.jar?download) and "clear" classpath, it must solve your problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.