I am trying to deploy a sample application to virgo (I put third-party jar files on repository/usr). after some long hours of resolving project dependencies I got ClassNotFound for "org.springframework.orm.hibernate3.LocalSessionFactoryBean", so I added spring-orm dependency on the manifest. the problem got solved but this time I got NoClassDefFound for "org/hibernate/cfg/Configuration". so I added "com.springsource.org.hibernate.core" on bundles in manifest but nothing happens: ... Caused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration at org.springframework.orm.hibernate3.LocalSessionFactoryBean.(LocalSessionFactoryBean.java:189) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) ... 20 common frames omitted I don't have a clue where to look for something suspicious!!! help me plz :|
Asked
Active
Viewed 219 times
2 Answers
0
You need Hibernate specific jars. The Spring-ORM jars just provide the integration with Hibernate. You still need the actual jars from Hibernate containing the implementations of those classes. Hope this helps.

chrislhardin
- 1,747
- 1
- 28
- 44
-
I have hibernate jar files in the repository, if they were not found i would get UnsatisfiedException or something like that! – AmirMV Oct 28 '12 at 08:12
-
you would get ClassNotFound or NoClassDefFound. You need to ensure the version of Spring and Hibernate will work together. Org.hibernate.cfg.Configuration is missing. I've had this problem many times and it is usually Spring expecting a specific version. Open the Hibernate jar to see if that class is there. – chrislhardin Oct 28 '12 at 11:05
-
been there, done that! i think the problem here refers to virgo. have you ever used virgo? – AmirMV Oct 28 '12 at 14:23
-
Yes, the problem is Virgo not locating the correct class java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration at org.springframework.orm.hibernate3.LocalSessionFactoryBean. – chrislhardin Oct 28 '12 at 14:43
-
http://stackoverflow.com/questions/4987082/osgi-spring-hibernate-virgo-example-classnotfoundexception-org-hibernate-cfg-co – chrislhardin Oct 28 '12 at 14:45
0
You need to see whether hibernate jar package is provided osgi mode, if not, you need to use the maven-bundle-plugin plug-in re-packaged. You need to see manifest.mf in META-INF folder. Wrong or not enough .mf file:
Manifest-Version: 1.0
Implementation-Vendor: The Redisson Project
Implementation-Title: Redisson/All-in-One
Implementation-Version: 2.10.1
Implementation-Vendor-Id: org.redisson
Built-By: root
Build-Jdk: 1.7.0_55
Specification-Vendor: The Redisson Project
Specification-Title: Redisson/All-in-One
Created-By: Apache Maven 3.5.0
Implementation-URL: http://redisson.org
Specification-Version: 2.10
Main-Class: org.redisson.RedissonNode
In .mf file:All the packages it depends on are under the Import-Package, and all users can use the package under the Export-Package,the above files do not contain these

Danny
- 1
- 2