-->
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: Initial Attempt Fails (Middelgen/hbm2java/MySQL)
PostPosted: Mon Mar 20, 2006 3:02 pm 
Newbie

Joined: Mon Mar 20, 2006 2:40 pm
Posts: 1
Hi, this is my first attempt at using Hibernate. I've used a top up approach, using Middelgen / hbm2java to generate mappings and source from an existing db. Everything compiles fine but running causes the following errors below, as far as I can tell, my classpath is correctly set up as it compiles and run without problems (until this exception). Any help would be most appreciated,

thanks.

Hibernate version: 3.1.2

Code between sessionFactory.openSession() and session.close():
Transaction tx = session.beginTransaction();
Colour newColour = new Colour();
newColour.setName("Blue");
newColour.setPicture("c:\blue.jpg");
session.save(newColour);
tx.commit();


Full stack trace of any exception that occurs: ERROR - CGLIB Enhancement failed: beayens.hibernate.Colour
java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at beayens.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
at beayens.hibernate.EventManager.main(EventManager.java:9)
WARN - could not create proxy factory for:beayens.hibernate.Colour
org.hibernate.HibernateException: CGLIB Enhancement failed: beayens.hibernate.Colour
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at beayens.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
at beayens.hibernate.EventManager.main(EventManager.java:9)
Caused by: java.lang.NoClassDefFoundError
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyIni
tializer.java:116)
... 13 more

Name and version of the database you are using:
MySQL (InnoDB)


Top
 Profile  
 
 Post subject: 2c
PostPosted: Mon Mar 20, 2006 6:34 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Runtime classpath should include more things than are necessary to compile.
Just for test include all jars from hibernate-3.zzzz/lib in the classpath and then remove ones you do not need - ant-zzz.jars will be first to delete :)

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.