-->
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.  [ 5 posts ] 
Author Message
 Post subject: CGLib NoClassDefFound Error only in Linux
PostPosted: Tue Apr 08, 2008 6:39 am 
Newbie

Joined: Tue Apr 08, 2008 6:13 am
Posts: 3
Hi folks,

After scouring Google and the fora here, I've had to revert to asking for help. :)

I have a web app that uses Spring 2.0.6 and Hibernate 3.2.1 and MySQL 5.x that deploys without problems to Tomcat 5.5 under Windows. However, deploying the same app to Tomcat on Ubuntu 7.10, I get the following error:

java.lang.NoClassDefFoundError: net.sf.cglib.proxy.Enhancer
java.lang.Class.initializeClass(libgcj.so.81)
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:111)
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:269)
org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
com.mydyo.persistence.HibernateUtil.init(HibernateUtil.java:20)
com.mydyo.web.controller.FaveQuestDispatcherServlet.init(FaveQuestDispatcherServlet.java:46)
org.apache.jsp.jsp.index_jsp._jspService(index_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


I have been assuming that CGLib or a dependency isn't visible in the CLASSPATH, but I've tried using the -nodep version of the jar, as well as pulling the individual Hibernate and CGLib jars out of WEB-INF/lib and moving them to common/lib under Tomcat - no joy. I also verified that Tomcat is using JDK 1.5. The security policies appear to be the same in both Windows and Linux.

I added a quick test servlet that verifies that I can talk to my Commons DBCP data source through straight JDBC - no issues there.

I'm at a loss and would appreciate any help.

Thanks in advance.

Dave Rooney


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 7:25 am 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
> java.lang.Class.initializeClass(libgcj.so.81)

Seems to be that your Tomcat picks up the GCJ-compiler (libgcj.so) and not the JDK. Please make sure that Tomcat uses java from the JDK (check PATH/JAVA_HOME/etc.pp.)

HTH, Maik


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 7:36 am 
Newbie

Joined: Tue Apr 08, 2008 6:13 am
Posts: 3
Quote:
Seems to be that your Tomcat picks up the GCJ-compiler (libgcj.so) and not the JDK. Please make sure that Tomcat uses java from the JDK (check PATH/JAVA_HOME/etc.pp.)


OK - that's a good start... my JAVA_HOME is currently pointing to /usr . running 'java -version' yields:

java version "1.5.0"
gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)

There are links in /usr/bin to the 'real' JDK 5 installation. I used apt-get to install the JDK - should I remove it and install it differently?

My experience with Debian/Ubuntu is limited - I've used FreeBSD before, and I'm not very familiar with the 'standard' installations locations. That ignorance may very well be part of the problem.

Thanks for the help!

Dave...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 3:36 pm 
Newbie

Joined: Tue Apr 08, 2008 6:13 am
Posts: 3
Found the problem... Tomcat was using a different JDK than I thought. The JDK list had it using GCJ rather than Sun's JDK, which was evident in the stack trace.

Thanks for the help - the hint got me looking in the right direction!

Dave...


Top
 Profile  
 
 Post subject: Help tomcat
PostPosted: Mon Sep 15, 2008 3:33 pm 
Newbie

Joined: Tue May 02, 2006 1:59 pm
Posts: 17
Location: California
Hi,

Where did you find this jdk list, which file was modified to do these changes ?

Reffering to your post: . Tomcat was using a different JDK than I thought. The JDK list had it using GCJ rather than Sun's JDK, which was evident in the stack trace.

THanks
Shobhana

_________________
Thanks


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