-->
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.  [ 7 posts ] 
Author Message
 Post subject: NoClassDefFoundError (CGLIB Enhancement failed) - now what?
PostPosted: Fri Jan 27, 2006 11:31 am 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Hello,

After using Hibernate for a while I noticed that whenever it has problems with missing libraries (jars), it throws NoClassDefFoundError (usually in CGLIBLazyInitializer.getProxyFactory method). The thing is it never says what is it exactly that it's missing.
Is there a way of finding out which out of the many jar files included with Hibernate is needed? Saying 'NoClassDefFoundError' without specifying which class is missing is not helping at all.
I'd appreciate any help on this subject.

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 12:53 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
try to make your logging more verbose (debug). This should give you a better hint on the missing class.

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 1:35 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
I tried to put log4j.properties in class path (containing single entry: log4j.logger.org.hibernate=debug), but that did not cause any new information to be printed in the log files (I'm running my code in a servlet, so I put log4j.properties in WEB-INF/classes folder). Is there any other way I can get the missing class/jar info to print in log files?

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 1:53 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
I do not know your application server. In JBoss which includes Tomcat you can set the logging to debug in the log4jxml in the conf directory.

There should be something like this for your server.

Just an idea but is asm missing?

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 2:17 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Yes, asm is there, same as asm-attrs. I'm using Sun App Server (formerly Sun One), the one that comes with J2EE 1.4.
I'll keep looking, if I find an answer I will post it here.
Thanks,

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 4:41 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
OK, so the problem was related to deployment procedure. If you're using Sun Server, don't use this option:

Specify a package file or a directory path that must be accessible from the server.

(This is on the Deploy Enterprise Application page of the admin console.)

Use this option:

Specify a package file to upload to the Application Server.

For some reason Hibernate classes could not be located in classpath. So now the Hibernate code kind of works (query results come back from db), but not entirely (updates don't work). I'm getting a new error now (Caused by: java.lang.NullPointerException at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
).
But that will be a separate post.

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 4:42 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
OK, I found a solution. On Russian Hibernate news group someone helpfully posted those two lines:

permission java.lang.RuntimePermission "getProtectionDomain";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";

If you put that in your server.policy file (Sun/AppServer/domains/domain1/config, under grant { ... };) your Hibernate app should stop getting those errors.
Of course all the required libraries (jars) must be present (I put them in WEB-INF/lib, and both servlets and EJBs have access to them).

So this concludes my 3 day hunt for an answer. And here's a short quiz:

Given the following data:

If Hibernate is missing required libraries, it throws NoClassDefFoundError.
If Hibernate is missing permissions, it throws NoClassDefFoundError.

Figure out the correct answer to the following question:

If your app server catches on fire, Hibernate throws ... ?


Bratek

PS. Big thank you to the fellow who posted the correct answer on Russian forum.


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