Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Spring ORM is throwing java.lang.NoClassDefFoundError: org/hibernate/MappingException
icon5.gif  Spring ORM is throwing java.lang.NoClassDefFoundError: org/hibernate/MappingException [message #815630] Wed, 07 March 2012 22:04 Go to next message
Matthew T. Adams is currently offline Matthew T. AdamsFriend
Messages: 58
Registered: July 2009
Location: Austin, TX
Member

Hi all,

Environment:
* Equinox (Bundle-Version: 3.5.2.R35x_v20100126, Bundle-SymbolicName: org.eclipse.osgi; singleton:=true),
* Spring 3.1.1.RELEASE,
* bnd-wrapped Hibernate 3.6.10.Final
* (SpringSource-wrapped) JPA API (javax.persistence:com.springsource.javax.persistence:2.0.0).

I'm getting a NoClassDefFoundError for org.hibernate.MappingException when Spring is trying to build my db bundle's sessionFactory bean:
03/07/12 19:16:34:705: [] [] [SpringOsgiExtenderThread-63]: ERROR org.springframework.osgi.extender.internal.activator.ContextLoaderListener - Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.ea.nucleus.db, config=osgibundle:/META-INF/
spring/*.xml))
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#1': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreation
Exception: Error creating bean with name 'sessionFactory' defined in URL [bundleentry://55.fwk1469937134/META-INF/spring/context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/MappingException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundleentry://55.fwk1469937134/META-INF/spring/context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFou
ndError: org/hibernate/MappingException
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:408)
        at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:166)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
        ... 14 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/MappingException
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getDeclaredConstructor(Class.java:1985)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:67)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
        ... 25 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 31 more



I'm surprised by this because the OSGi console is reporting that my db bundle is importing the org.hibernate package and that it's properly being exported from my wrapped Hibernate bundle:
osgi> packages org.hibernate
org.hibernate; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
  com.ea.nucleus.db_3.53.0.SNAPSHOT [55] imports
  ...


OSGi is reporting also that my db bundle is properly importing package org.hibernate:
osgi> bundle 55
com.ea.nucleus.db_3.53.0.SNAPSHOT [55]
(...)
  Exported packages
(...)
  Imported packages
(...)
    javax.persistence; version="2.0.0"<com.springsource.javax.persistence_2.0.0 [22]>
    javax.sql; version="0.0.0"<org.eclipse.osgi_3.5.2.R35x_v20100126 [0]>
    javax.validation; version="1.0.0.GA"<com.springsource.javax.validation_1.0.0.GA [24]>
    javax.validation.bootstrap; version="1.0.0.GA"<com.springsource.javax.validation_1.0.0.GA [24]>
    javax.validation.constraints; version="1.0.0.GA"<com.springsource.javax.validation_1.0.0.GA [24]>
    javax.validation.spi; version="1.0.0.GA"<com.springsource.javax.validation_1.0.0.GA [24]>
(...)
    org.hibernate; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.annotations; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.cache; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.cache.access; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.cfg; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.classic; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.criterion; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.engine; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.event; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.exception; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.jdbc; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.metadata; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.persister.entity; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.proxy; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.transform; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.tuple.entity; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.type; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.util; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.validator; version="4.1.0.Final"<com.ea.nucleus.hibernate-validator_4.1.0.Final [42]>
    org.hibernate.validator.constraints; version="4.1.0.Final"<com.ea.nucleus.hibernate-validator_4.1.0.Final [42]>
    org.slf4j; version="1.5.11"<com.ea.nova.supernova.core_8.0.0 [1]>
    org.springframework.beans.factory; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.beans.factory.annotation; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.dao; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.jmx.export; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.jmx.export.assembler; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.jmx.support; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.orm.hibernate3; version="3.1.1.RELEASE"<org.springframework.orm_3.1.1.RELEASE [13]>
    org.springframework.orm.hibernate3.annotation; version="3.1.1.RELEASE"<org.springframework.orm_3.1.1.RELEASE [13]>
    org.springframework.orm.hibernate3.support; version="3.1.1.RELEASE"<org.springframework.orm_3.1.1.RELEASE [13]>
    org.springframework.transaction; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.transaction.support; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.util; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
  No fragment bundles
  Named class space
    com.ea.nucleus.db; bundle-version="3.53.0.SNAPSHOT"[provided]
  No required bundles

I see something that is a little bit suspicious in the spring-orm bundle: package org.hibernate is not explicitly listed as an imported package, even though it's specified in the "uses" clause of the bundle's export of org.springframework.orm.hibernate3. The OSGi console reports the following for the spring-orm bundle:
osgi> bundle 13
org.springframework.orm_3.1.1.RELEASE [13]
  Id=13, Status=ACTIVE      Data Root=/home/nucleus/nucleus/spring311/equinox/configuration/org.eclipse.osgi/bundles/13/data
  No registered services.
  No services in use.
  Exported packages
    org.springframework.orm; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.hibernate3; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.hibernate3.annotation; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.hibernate3.support; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.hibernate4; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.hibernate4.support; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.ibatis; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.ibatis.support; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jdo; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jdo.support; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jpa; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jpa.persistenceunit; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jpa.support; version="3.1.1.RELEASE"[exported]
    org.springframework.orm.jpa.vendor; version="3.1.1.RELEASE"[exported]
  Imported packages
    javax.persistence; version="2.0.0"<com.springsource.javax.persistence_2.0.0 [22]>
    javax.persistence.criteria; version="2.0.0"<com.springsource.javax.persistence_2.0.0 [22]>
    javax.persistence.spi; version="2.0.0"<com.springsource.javax.persistence_2.0.0 [22]>
    javax.sql; version="0.0.0"<org.eclipse.osgi_3.5.2.R35x_v20100126 [0]>
    javax.transaction; version="1.1.0"<com.springsource.javax.transaction_1.1.0 [23]>
    javax.xml.parsers; version="0.0.0"<org.eclipse.osgi_3.5.2.R35x_v20100126 [0]>
    org.aopalliance.intercept; version="1.0.0"<com.springsource.org.aopalliance_1.0.0 [28]>
    org.apache.commons.logging; version="1.1.1"<com.ea.nova.supernova.core_8.0.0 [1]>
    org.hibernate.annotations; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.cache; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.cache.access; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.classic; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.connection; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.hibernate.exception; version="3.6.10.Final"<com.ea.nucleus.hibernate-jpa-all_3.6.10.Final [44]>
    org.springframework.aop.scope; version="3.1.1.RELEASE"<org.springframework.aop_3.1.1.RELEASE [2]>
    org.springframework.aop.support; version="3.1.1.RELEASE"<org.springframework.aop_3.1.1.RELEASE [2]>
    org.springframework.beans; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.beans.factory; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.beans.factory.annotation; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.beans.factory.config; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.beans.factory.support; version="3.1.1.RELEASE"<org.springframework.beans_3.1.1.RELEASE [5]>
    org.springframework.context; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.context.weaving; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.core; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.core.io; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.core.io.support; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.core.type; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.core.type.classreading; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.core.type.filter; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.dao; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.dao.support; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.instrument.classloading; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.jdbc; version="3.1.1.RELEASE"<org.springframework.jdbc_3.1.1.RELEASE [11]>
    org.springframework.jdbc.datasource; version="3.1.1.RELEASE"<org.springframework.jdbc_3.1.1.RELEASE [11]>
    org.springframework.jdbc.datasource.lookup; version="3.1.1.RELEASE"<org.springframework.jdbc_3.1.1.RELEASE [11]>
    org.springframework.jdbc.support; version="3.1.1.RELEASE"<org.springframework.jdbc_3.1.1.RELEASE [11]>
    org.springframework.jdbc.support.lob; version="3.1.1.RELEASE"<org.springframework.jdbc_3.1.1.RELEASE [11]>
    org.springframework.jndi; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.transaction; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.transaction.jta; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.transaction.support; version="3.1.1.RELEASE"<org.springframework.transaction_3.1.1.RELEASE [14]>
    org.springframework.ui; version="3.1.1.RELEASE"<org.springframework.context_3.1.1.RELEASE [6]>
    org.springframework.util; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.springframework.util.xml; version="3.1.1.RELEASE"<org.springframework.core_3.1.1.RELEASE [8]>
    org.w3c.dom; version="0.0.0"<org.eclipse.osgi_3.5.2.R35x_v20100126 [0]>
    org.xml.sax; version="0.0.0"<org.eclipse.osgi_3.5.2.R35x_v20100126 [0]>
  No fragment bundles
  Named class space
    org.springframework.orm; bundle-version="3.1.1.RELEASE"[provided]
  No required bundles


Something that I can't really explain yet either is that bnd reports that the spring-orm bundle is importing org.hibernate, even though it's not explicitly listed in the bundle manifest's Import-Package section:
C:\...>bnd org.springframework.orm-3.1.1.RELEASE.jar
[MANIFEST org.springframework.orm-3.1.1.RELEASE.jar]
Ant-Version                             Apache Ant 1.8.2
Bundle-Creator                          bamboo
Bundle-ManifestVersion                  2
Bundle-Name                             Spring ORM
Bundle-SymbolicName                     org.springframework.orm
Bundle-Vendor                           SpringSource
Bundle-Version                          3.1.1.RELEASE
Created-By                              1.6.0_27-b07 (Sun Microsystems Inc.)
(...)
[IMPEXP]
Import-Package
(...)
  javax.persistence                     {version=[1.0.0, 3.0.0), resolution:=optional}
  javax.persistence.criteria            {version=[1.0.0, 3.0.0), resolution:=optional}
  javax.persistence.spi                 {version=[1.0.0, 3.0.0), resolution:=optional}
(...)
  javax.sql                             {version=0, resolution:=optional}
  javax.transaction                     {version=[1.0.1, 2.0.0), resolution:=optional}
(...)
  org.hibernate                         {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.annotations             {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.cache                   {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.cache.access            {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.cfg                     {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.classic                 {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.connection              {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.context                 {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.context.internal        {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.context.spi             {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.criterion               {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.dialect                 {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.ejb                     {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.engine                  {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.engine.spi              {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.engine.transaction.spi  {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.event                   {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.event.def               {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.exception               {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.impl                    {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.jdbc                    {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.persister.entity        {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.service                 {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.service.jdbc.connections.spi{version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.service.jta.platform.spi{version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.service.spi             {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.tool.hbm2ddl            {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.transaction             {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.transform               {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.type                    {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.usertype                {version=[3.2.0, 5.0.0), resolution:=optional}
  org.hibernate.util                    {version=[3.2.0, 5.0.0), resolution:=optional}
(...)


I'm wrapping Hibernate 3.6.10.Final using the following pom, which includes hibernate-entitymanager, hibernate-core, and hibernate-commons-annotations:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

	<groupId>org.hibernate</groupId>
    <artifactId>com.ea.nucleus.hibernate-jpa-all</artifactId>
    <version>3.6.10.Final</version>
    <packaging>bundle</packaging>

    <name>${project.artifactId}</name>
    <description>${project.groupId}:${project.artifactId}</description>

	<dependencies>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-commons-annotations</artifactId>
			<version>3.2.0.Final</version>
		</dependency>
	</dependencies>

	<build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Import-Package>
							*;resolution:=optional
						</Import-Package>
                        <Export-Package>
							org.hibernate*;version=${project.version};-split-package:=merge-first;-noimport:=true
                        </Export-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


Can anyone tell me what I need to do in order to get spring-orm to be able to see classes in package org.hibernate?

Thanks,
Matthew
Re: Spring ORM is throwing java.lang.NoClassDefFoundError: org/hibernate/MappingException [message #816460 is a reply to message #815630] Thu, 08 March 2012 22:05 Go to previous message
Matthew T. Adams is currently offline Matthew T. AdamsFriend
Messages: 58
Registered: July 2009
Location: Austin, TX
Member

Fixed. Problem was that my db bundle, the hibernate wrapped bundle and the spring bundle were picking up different versions of javax.transaction.

Adding the following <Import-Package> entries to my wrapped hibernate bundle's maven-bundle-plugin configuration fixed it:
javax.transaction;version=1.1,
javax.transaction.xa;version=1.1


Hope this helps somebody somewhere sometime. Smile

-matthew
Previous Topic:Problems launching an OSGi Framework under debian
Next Topic:bundles.info can not be updated after install new plugin?
Goto Forum:
  


Current Time: Sat Nov 27 23:01:59 GMT 2021

Powered by FUDForum. Page generated in 0.01668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top