It's very difficult to guess, but I think the tip is:
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabledSomething related yet with Hibernate or cglib or its dependencies... You are building a single jar with all dependencies packaged in it, right? Maybe some dependencies are overwriting classes. Do a test without packaging this way.
I added one dependency some time ago, which had a misbehavior of declare a specific version dependency. I needed to add the <exclude></exclude> element in the dependency declaration to remove the extra library.
All the best! Mikel Cármenes Cavia escreveu:
Here is the complete exception, in case this helps: C:\DEV\Maven\GITSYSTEMS\target>java -jar GITSYSTEMS-1.0-jar-with-dependencies.jar 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) at org.git.systems.data.dao.UserDAO.validateUser(UserDAO.java:49) at org.git.systems.system.UserManager.loginUser(UserManager.java:57) at org.git.systems.gui.LoginJDialog.actionPerformed(LoginJDialog.java:174) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.AbstractButton.doClick(Unknown Source) at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(Unknown Source) at javax.swing.SwingUtilities.notifyAction(Unknown Source) at javax.swing.JComponent.processKeyBinding(Unknown Source) at javax.swing.KeyboardManager.fireBinding(Unknown Source) at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source) at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source) at javax.swing.JComponent.processKeyBindings(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.Dialog$1.run(Unknown Source) at java.awt.Dialog$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Dialog.show(Unknown Source) at java.awt.Component.show(Unknown Source) at java.awt.Component.setVisible(Unknown Source) at java.awt.Window.setVisible(Unknown Source) at java.awt.Dialog.setVisible(Unknown Source) at org.git.systems.gui.LoginJDialog.<init>(LoginJDialog.java:44) at org.git.systems.gui.mainwindow.GITCAPMainJFrame.<init>(GITCAPMainJFrame.java:63) at org.git.systems.GITCap$1.run(GITCap.java:61) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.NoClassDefFoundError at org.hibernate.tuple.EntityMetamodel.class$(EntityMetamodel.java:41) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:122) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:10 8) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176) at org.git.systems.data.HibernateUtil.<clinit>(HibernateUtil.java:65) ... 53 more Caused by: java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabled at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) ... 61 more Thanks! On Fri, Jun 13, 2008 at 10:18, Mikel Cármenes Cavia <[EMAIL PROTECTED]> wrote: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
-- 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
begin:vcard fn:Fabio Oliveira n:Oliveira;Fabio org;quoted-printable:S=C3=ADmula Sistemas de Planejamento e Com=C3=A9rcio Ltda. adr;quoted-printable:;;Av. Jos=C3=A9 Bonif=C3=A1cio, 2510;Campinas;SP;13093-240;Brazil email;internet:[EMAIL PROTECTED] title:Gerente de Projetos de Software tel;work:+55 19 3295-2111 tel;cell:+55 19 9270-6574 x-mozilla-html:FALSE url:http://www.simula.com.br version:2.1 end:vcard
smime.p7s
Description: S/MIME Cryptographic Signature
