Thanks Fabio, I should have realized that I was adding cglib twice, since
Hibernate adds it already as a transitive dependency. So I have removed
cglib from my pom, but now I get an event dispatching error when the session
factory is built.
This is the code where the problem resides:
...
.addClass(org.git.systems.data.SampleState.class);
sessionFactory = cfg.buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed. " + ex);
throw new ExceptionInInitializerError(ex);
}
And this is the exception:
Initial SessionFactory creation failed. java.lang.NoClassDefFoundError
Exception occurred during event dispatching:
java.lang.ExceptionInInitializerError
at org.git.systems.data.HibernateUtil.<clinit>(HibernateUtil.java:71)
It seems like Hibernate is looking for something it can't find, and I'm
totally clueless as to what that might be...
Mikel
2008/6/13 Fabio Braga de Oliveira <[EMAIL PROTECTED]>:
> Hi Mikel,
>
> This happened to me when 2 different cglib versions where added to the
> build. Look for a library adding the cglib as a transitive dependency, and
> exclude the oldest one.
>
> Good luck!
>
>
> Mikel Cármenes Cavia escreveu:
>
> Hey guys,
>> Does anybody know what the following error might be caused by?
>>
>> 09:20:16,140 ERROR BasicLazyInitializer:130 - CGLIB Enhancement failed:
>> org.git.systems.data.PcCalc
>> java.lang.NoClassDefFoundError: Could not initialize class
>> net.sf.cglib.proxy.Enhancer
>>
>> I've made sure that cglib is correctly added, and its .jar is indeed there
>> when I check. This error has to do with Hibernate not being able to access
>> this resource, thus it cannot execute sessionFactory =
>> cfg.buildSessionFactory(); and communicate with the database.
>>
>> I can't think of anything as far as Maven goes that could be going wrong,
>> since compiling and packaging works fine, I only get messages after the
>> login panel of my application (that is, I try to log in and when it
>> connects
>> to the database to check my info, I get these errors).
>>
>> All errors whine about the same CGLIB Enhancement failing, so I'm guessing
>> that every single class that requires Hibernate is throwing these
>> exceptions.
>>
>> Any clues as to why this may be happening? Has anyone else ever had any
>> issues with cglib?
>>
>> Thanks!
>>
>>
>
> --
> Fabio Braga de Oliveira
> Gerente de Projetos de Software
> Work: +55 19 3295-2111
> Mobile: +55 19 9270-6574
> E-mail: [EMAIL PROTECTED]
>
> Símula Sistemas de Planejamento e Comércio Ltda.
> Url: http://www.simula.com.br
> Address: Av. José Bonifácio, 2510
> Zipcode 13093-240
> Campinas - SP - Brazil
>
>
>