Sorry, I tried don't send a fool question to this forum but i can't find a solution for my problem. Please, someone help me.
Hibernate version:
2.1.7
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="hello.Message"
table="Message">
<id
name="id"
column="message_id"
type="long">
<generator class="native"/>
</id>
<property
name="text"
column="message_text"/>
<many-to-one
name="nextMessage"
cascade="all"
column="next_message_id"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
Configuration cfg = new Configuration();
cfg.addResource("hello/Message.hbm.xml");
cfg.setProperties(System.getProperties());
SessionFactory sessions = cfg.buildSessionFactory();
Session session = sessions.openSession(); //getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Message message = new Message("Hello world");
session.save(message);
tx.commit();
session.close();
Full stack trace of any exception that occurs:Code:
2006-04-11 17:08:18,546 INFO hibernate.cfg.Environment -> Hibernate 2.1.8
2006-04-11 17:08:18,556 INFO hibernate.cfg.Environment -> loaded properties from resource hibernate.properties: {hibernate.c3p0.timeout=300, hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.c3p0.max_statements=50, hibernate.c3p0.max_size=30, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.c3p0.idle_test_period=3000, hibernate.c3p0.min_size=5, hibernate.connection.username=root, hibernate.connection.url=jdbc:mysql://192.168.10.100:3306/temp, hibernate.connection.password=root}
2006-04-11 17:08:18,558 INFO hibernate.cfg.Environment -> using CGLIB reflection optimizer
2006-04-11 17:08:18,562 INFO hibernate.cfg.Environment -> using JDK 1.4 java.sql.Timestamp handling
2006-04-11 17:08:18,565 INFO hibernate.cfg.Configuration -> Mapping resource: hello/Message.hbm.xml
2006-04-11 17:08:18,827 DEBUG hibernate.util.DTDEntityResolver -> trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
2006-04-11 17:08:18,831 DEBUG hibernate.util.DTDEntityResolver -> http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtdnot found in classpath
2006-04-11 17:08:20,766 INFO hibernate.cfg.Binder -> Mapping class: hello.Message -> Message
2006-04-11 17:08:20,811 DEBUG hibernate.cfg.Binder -> Mapped property: id -> message_id, type: long
2006-04-11 17:08:20,818 DEBUG hibernate.cfg.Binder -> Mapped property: text -> message_text, type: string
2006-04-11 17:08:20,822 DEBUG hibernate.cfg.Binder -> Mapped property: nextMessage -> next_message_id, type: hello.Message
2006-04-11 17:08:20,823 INFO hibernate.cfg.Configuration -> processing one-to-many association mappings
2006-04-11 17:08:20,824 INFO hibernate.cfg.Configuration -> processing one-to-one association property references
2006-04-11 17:08:20,824 INFO hibernate.cfg.Configuration -> processing foreign key constraints
2006-04-11 17:08:20,825 DEBUG hibernate.cfg.Configuration -> resolving reference to class: hello.Message
2006-04-11 17:08:20,837 INFO hibernate.dialect.Dialect -> Using dialect: net.sf.hibernate.dialect.MySQLDialect
2006-04-11 17:08:20,859 DEBUG hibernate.exception.SQLExceptionConverterFactory -> Using dialect defined converter
2006-04-11 17:08:20,861 INFO hibernate.cfg.SettingsFactory -> Maximim outer join fetch depth: 2
2006-04-11 17:08:20,862 INFO hibernate.cfg.SettingsFactory -> Use outer join fetching: true
2006-04-11 17:08:20,871 WARN hibernate.connection.UserSuppliedConnectionProvider -> No connection properties specified - the user must supply JDBC connections
2006-04-11 17:08:20,886 INFO hibernate.transaction.TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
2006-04-11 17:08:20,893 INFO hibernate.cfg.SettingsFactory -> Use scrollable result sets: false
2006-04-11 17:08:20,894 INFO hibernate.cfg.SettingsFactory -> Use JDBC3 getGeneratedKeys(): false
2006-04-11 17:08:20,895 INFO hibernate.cfg.SettingsFactory -> Optimize cache for minimal puts: false
2006-04-11 17:08:20,895 INFO hibernate.cfg.SettingsFactory -> Query language substitutions: {}
2006-04-11 17:08:20,896 INFO hibernate.cfg.SettingsFactory -> cache provider: net.sf.hibernate.cache.EhCacheProvider
2006-04-11 17:08:20,905 DEBUG hibernate.cfg.SettingsFactory -> Wrap result sets enabled? : false
2006-04-11 17:08:20,905 INFO hibernate.cfg.Configuration -> instantiating and configuring caches
2006-04-11 17:08:20,907 DEBUG sf.ehcache.CacheManager -> Creating new CacheManager with default config
2006-04-11 17:08:20,911 DEBUG sf.ehcache.CacheManager -> Configuring ehcache from classpath.
2006-04-11 17:08:20,923 WARN ehcache.config.Configurator -> No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/leandro/libs/hibernate-2.1/lib/ehcache-0.9.jar!/ehcache-failsafe.xml
2006-04-11 17:08:20,931 DEBUG ehcache.config.Configuration$DiskStore -> Disk Store Path: /tmp
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at Main.main(Main.java:18)
Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:236)
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:237)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:218)
... 7 more
Caused by: java.lang.IllegalAccessError: class net.sf.hibernate.impl.SessionFactoryImpl$QueryCacheKeyFactory$$KeyFactoryByCGLIB$$601120ed cannot access its superinterface net.sf.hibernate.impl.SessionFactoryImpl$QueryCacheKeyFactory
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
... 13 more
Name and version of the database you are using:
MySQL 4.1
This is the Hello World Aplication from "Hibernate em Ação" first version.
Thank you.
Leandro