Hi,
I said I should be able to figure out how to get Hibernate to work, but I guess I'll have to take that back.
Hear me, oh Muse, about the wrath of Java, that terrible wrath which caused my application to fail so numerous times, even now.
- I installed Eclipse 3.1 with lots of goodies. Both to see what they could do for me, as well as just to have an IDE.
- I installed Hibernate 3.0
- I added hibernate-tools to Eclipse. Let me ignore that. It didn't work and still doesn't.
- I wrote a small standalone application, using the HibernateUtil class from the reference, a simple POJO class and an Oracle database.
- I created Library entries for Hibernate and Oracle. The first simply contains all jar files in the lib directory (plus hibernate3.jar) and the second the oracle jar file.
- I got a NullPointerException in the logging stuff. End of day one.
- A German Gentleman I found on this forum had this Exception as well, and he was told to try commons-logging-1.0.5. It's in Alpha, but yes, that got rid of the NullPointerException.
- Next I got a timeout... The forums suggested I was trying to use the 2.0 DTD, but no, I correctly specified the 3.0 DTD. Hmmm... I am behind a proxy server, but adding it didn't help.
- Tried copying the DTDs to my classpath, but that didn't work either. Next I redid the DTD URL to become a file reference with an absolute path. That works. (How in hell am I going to distribute this app??? Never mind, let's get it to work first.)
- Next exception: java.lang.IllegalAccessError. Huh? The Factory is trying to instantiate some stuff, generate some code, and it fails.
- The only reference I find in the forums to this exception is from someone who says it is because the classpath is wrong, but it contains all Hibernate jars there are. What more does it want? The log has found my Database, I see it correctly enumerating the installed Oracle options.
Please.. someone? HEEEEEEELP!
Bert Laverman
(appearently an absolute beginner. Let's hope my employer won't find out)
Code:
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: ClassModel.hbm.xml
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.syllogic.asmv2.data.ClassModel -> ClassModel
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Oct 3, 2005 1:11:07 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Oct 3, 2005 1:11:07 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Oct 3, 2005 1:11:07 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Oct 3, 2005 1:11:07 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@amaro.syllogic.com:1521:randd
Oct 3, 2005 1:11:07 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=asm, password=****}
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: Oracle, version: Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: Oracle JDBC driver, version: 9.2.0.6.0
Oct 3, 2005 1:11:07 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.Oracle9Dialect
Oct 3, 2005 1:11:07 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Oct 3, 2005 1:11:07 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Oct 3, 2005 1:11:07 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Oct 3, 2005 1:11:07 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Initial Session Factory Creation Failed
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.syllogic.asmv2.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:26)
at com.syllogic.asmv2.hibernate.Main.main(Main.java:29)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at com.syllogic.asmv2.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:22)
... 1 more
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 org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:321)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:218)
... 8 more
Caused by: java.lang.IllegalAccessError: class org.hibernate.impl.SessionFactoryImpl$QueryCacheKeyFactory$$KeyFactoryByCGLIB$$f37b4e4d cannot access its superinterface org.hibernate.impl.SessionFactoryImpl$QueryCacheKeyFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 14 more