File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes cglib-2.1.3.jar is in the classpath still giving java.lang.NoClassDefFoundError: net/sf/cglib/beans/ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "cglib-2.1.3.jar is in the classpath still giving java.lang.NoClassDefFoundError: net/sf/cglib/beans/" Watch "cglib-2.1.3.jar is in the classpath still giving java.lang.NoClassDefFoundError: net/sf/cglib/beans/" New topic
Author

cglib-2.1.3.jar is in the classpath still giving java.lang.NoClassDefFoundError: net/sf/cglib/beans/

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
Hi,

I have an EJB project deployed in jboss-5.1.0. I have cglib-2.1.3.jar in my classpath and when I do "echo $CLASSPATH" it is also listed there. But still I am getting "java.lang.reflect.InvocationTargetException" caused by "java.lang.NoClassDefFoundError: net/sf/cglib/beans/BulkBeanException". I searched in net they are suggesting that cglib should be there in classpath.I already have that in my classpath. My project has jboss service in it which will copy some data from Mysql and insert it in HSQl.Both the db interaction is done by hibernate.I am cold deploying my EJB application.And getting this message
"Error installing to Create: name=jboss.j2ee:jar=SDP_MTN_TIM_Telus_OI_V9.jar,name=DbStartUpService,service=EJB3 state=Configured" followed by the exception trace.My project name has been highlighted.

Looking for some help....

Regards,
Arka
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
One more thing I want to add here that is I am using the same jboss copy same HSQL and Mysql in a different server and I also have the same application deployed.(Since I have the same copy of whole jboss folder) where I am not getting this exception.Along with that I am having the same copy of .bash_profile where all the classpaths are defined.Following are the output of "uname -a" command in both the servers

Linux SDP139 2.6.9-89.EL #1 Mon Apr 20 10:23:08 EDT 2009 i686 i686 i386 GNU/Linux
(Getting exception on this server)

Linux localhost.localdomain 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux (This server no exceptions are coming)

Regards,
Arka
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
One more thing I have just figured out while going through the exception trace that I have one call to "sessionFactory = configuration.buildSessionFactory();" in my code.This is the topmost trace among the entries of my code in the exception trace.However same code is there in another server as I mentioned earlier which was throwing no exception.

Regards,
Arka
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
I also checked for multiple jar entries of cglib.So I did "find / | grep cglib" which gives me only one cglib jar which is already added in the classpath.So no cglib in JBOSS_HOME/server/default/lib which cause multile classpath entry for the same jar.

Regards,
Arka
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

Try using this version of cglib

http://mvnrepository.com/artifact/cglib/cglib-nodep/2.2


[How To Ask Questions][Read before you PM me]
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103

Thanks for your reply.Sorry still no luck.Same exception is coming followed by lot of others.

Regards,
Arka
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
I tried after rebooting the server with no luck.I ahve noticed some difference in working and not working jboss console output.

The working copy is showing

19:44:00,077 INFO [Environment] Hibernate 3.3.1.GA
19:44:00,110 INFO [Environment] hibernate.properties not found
19:44:00,116 INFO [Environment] Bytecode provider name : javassist

The non working copy was showing

19:49:28,817 INFO [Environment] Hibernate 3.1.1
19:49:28,823 INFO [Environment] hibernate.properties not found
19:49:28,825 INFO [Environment] using CGLIB reflection optimizer

followed by exception trace

Both jboss copies are same.Both class path entries are same.And all jars are in the classpath are in the same path hierarchy in both the servers.

Regards,
Arka
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

Arka Sharma wrote:
Both jboss copies are same.Both class path entries are same.And all jars are in the classpath are in the same path hierarchy in both the servers.


Clearly they are not. They are using different versions of hibernate. And the newer version appears to be using javaassist rather than cglib. I would try to find out where it is finding Hibernate 3.1.1.
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103

Like I said JBoss and .bash_profile copies and the path to the jars added in the CLASSPATH all are same. But no clue why one is using Hibernate 3.1.1(non working) and another Hibernate.3.3.1 GA(working). The non working copy is using CGLIB and working copy is using is Javassit.

Regards,
Arka
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: cglib-2.1.3.jar is in the classpath still giving java.lang.NoClassDefFoundError: net/sf/cglib/beans/
 
Similar Threads
MappingException...please help..
Hibernate class not found Exception!!
NoClassDefFoundError:
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
EJB Testing using JUnit