-->
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.  [ 11 posts ] 
Author Message
 Post subject: Very strange NoClassDefFoundError
PostPosted: Tue Jun 08, 2004 3:20 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
Hi,

i have some very strange problems lately, since I migrated my project to hibernate:

I get strange "NoClassDefFoundError"s, but the requested class is definitely compiled and in the classpath.
I am not shure wether this is a hibernate problem, a Intellij IDEA problem or a Mac OS X VM problem.

Anyone ever heard of something similar?

This is on Mac OS X 10.3, using 1.4.2, IDEA 4.0 and hibernate 2.13.

Here is a stacktrace:

java.lang.NoClassDefFoundError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at net.sf.hibernate.persister.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:353)
at net.sf.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1773)
at net.sf.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1765)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:502)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:915)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:890)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3259)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3114)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2106)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1980)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1916)
at de.webjazz.pleasure.backend.persist.PersistHelper.load(PersistHelper.java:227)
at de.webjazz.pleasure.backend.CustomerFactory.createFullModel(CustomerFactory.java:20)
at de.webjazz.pleasure.application.FullModelLoader$1.run(FullModelLoader.java:34)

Regards,

Alex


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 6:38 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Not enough informations with your trace.
But I think it's Jar path problem.


Top
 Profile  
 
 Post subject: ?
PostPosted: Tue Jun 08, 2004 7:04 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
Hi,

surely sounds like it.

BUT: That compiled class is inside my build/classes dir where all other classes remain as well.

Regards,

Alex


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 10:17 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
But what kind of application do you create J2EE, standalone?
And your app server JBoss? Tomcat?


Top
 Profile  
 
 Post subject: ...
PostPosted: Tue Jun 08, 2004 10:54 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
This a standalone Swing App.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 3:57 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Could you give me a more detailed stacktrace please?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 11:35 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
Hi,

there is not much more stacktracing: I get the same error when instanciating the class manually.

I just tried, if the same behavior appears when I use the latest Developer Preview Java 1.4.2 Upg2 from Apple.
But I found this a very buggy version, which renders my Application an also Intellij IDEA useless.
But the problem is still there.

Here is a little more description:

All of a sudden one of my Model Classes seem to be invisible by the VM.
Every effort to create an instance of it throws an "NoClassDefFoundError".

When I rename some of the properties, try creating an instance from the "main" Thread, rebuild the whole project ... All of a sudden the class is visible again. There is definitely no rule to find.

I start believing in a VM-Bug.

Regards,

Alex


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 1:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
If you are using HibernateUtil from the reference documentation, read this thread: http://forum.hibernate.org/viewtopic.php?t=931482

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 2:29 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
Here is some more info:

java.lang.NoClassDefFoundError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at net.sf.hibernate.persister.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:353)
at net.sf.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1773)
at net.sf.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1765)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:502)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:915)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:890)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3259)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3114)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2106)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1980)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1916)
at de.webjazz.pleasure.backend.persist.PersistHelper.load(PersistHelper.java:227)
at de.webjazz.pleasure.backend.CustomerFactory.createFullModel(CustomerFactory.java:20)
at de.webjazz.pleasure.application.FullModelLoader$1.run(FullModelLoader.java:34)

or here when creating an instance of that class "manually":

apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError
at de.webjazz.pleasure.backend.model.customer.impl.CustomerModelImpl.createProcedure(CustomerModelImpl.java:236)
at de.webjazz.pleasure.order.tree.OrderTreeController$CreateAction.actionPerformed(OrderTreeController.java:122)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1819)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1872)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:247)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:481)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Here is the code from CustomerModelImpl:

public ProcedureModel createProcedure(ProcedureState state) {
ProcedureModelImpl m = new ProcedureModelImpl();
m.setCustomer(this);
m.setState(state);
return m;
}

The following is now 100% reproducable:
If I create an instance of this class in the "main" Thread:

public static void main(String[] args) {
ProcedureModelImpl m = new ProcedureModelImpl(); // Dummy

_log.info("Application starting");
AppUtilities.setLookAndFeel();
new VersionChecker();
new StartupController();
}

Everything seems fine. No errors.
But if I remove the firstline I get the above errors.

Very strange ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 6:46 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
I'm not sure but your error seems come from Java 3D with OSx.
Make sure that you have this class in your classpath
apple.awt.EventQueueExceptionHandler.

I never work with your configuration so I can't help you so much sorry.
But try with a standalone command line client.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 10:41 am 
Beginner
Beginner

Joined: Tue May 11, 2004 8:24 am
Posts: 23
Problem solved!

If anyone is interested:

In my code I was calling a hibernate lookup inside my default constructor.
So what happened was: Hibernate actualy creates a first instance of my modelclass to verify reflection. (I didn't know that.) This first constuctor leaded to a roundtrip loop as it was trying to start hibernate to get some default values.
This must have confused the classloader, which lateron declared this class as not existent!

...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.