我正在使用 Fuse Fabric 6.1.0-redhat-379。我们将基于 spring 的应用程序迁移到蓝图 osgi 应用程序。以前我们使用带有hibernate的spring orm来访问数据库。我试图将 spring orm(服务组合包)移植到蓝图容器。现在我面临一个错误,即在 hibernate-core 包中找不到映射资源文件中存在的实体对象。但同样存在于我的应用程序包中。
<bean id="sessionFactoryBean"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
activation="eager" init-method="afterPropertiesSet">
<property name="dataSource" ref="dataSourceRef" />
<property name="mappingLocations">
<list>
<bean class="com.base.support.io.BundleResource">
<argument index="0" type="java.lang.String" value="com/reference/vo/hbm/Reference.hbm.xml" />
<argument index="1" type="org.osgi.framework.BundleContext" ref="blueprintBundleContext"/>
</bean>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">${showSql}</prop>
<prop key="hibernate.dialect">${dialect}</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
</props>
</property>
</bean>
t.core - 1.0.1.redhat-610379 | 无法启动 bundle common 的蓝图容器 org.osgi.service.blueprint.container.ComponentDefinitionException:无法初始化 bean sessionFactoryBean 在 org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_75] 在 org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:676)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:374)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:270)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:233)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.0.1.redhat-610379] 在 org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.0.1.redhat-610379] 在 org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.0.1.redhat-610379] 在 org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.0.1.redhat-610379] 在 org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.0.1.redhat-610379] 在 org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4650)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.Felix$4.run(Felix.java:2123)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.Felix.runInContext(Felix.java:2147)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.Felix.startBundle(Felix.java:2121)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)[org.apache.felix.framework-4.0.3.redhat-610379.jar:] 在 io.fabric8.agent.DeploymentAgent.install(DeploymentAgent.java:743)[60:io.fabric8.fabric-agent:1.0.0.redhat-379] 在 io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:525)[60:io.fabric8.fabric-agent:1.0.0.redhat-379] 在 io.fabric8.agent.DeploymentAgent$2.run(DeploymentAgent.java:252)[60:io.fabric8.fabric-agent:1.0.0.redhat-379] 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_75] 在 java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_75] 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_75] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_75] 在 java.lang.Thread.run(Thread.java:745)[:1.7.0_75] 引起:org.hibernate.MappingException:找不到实体类:com.common.reference.vo.ReferenceVO 在 org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:138) 在 org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:497) 在 org.hibernate.tuple.PropertyFactory.buildIdentifierAttribute(PropertyFactory.java:87) 在 org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:163) 在 org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:520) 在 org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:148) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_75] 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_75] 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_75] 在 java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_75] 在 org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) 在 org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) 在 org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:401) 在 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) 在 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) 在 org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:252) 在 org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:377) 在 org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:362) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_75] 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_75] 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_75] 在 java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_75] 在 org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] 在 org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[9:org.apache.aries.blueprint.core:1.0.1.redhat-610379] ... 34 更多 原因:java.lang.ClassNotFoundException:org.hibernate.core 未找到 com.common.reference.vo.ReferenceVO [1161] 在 org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) 在 org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) 在 org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_75] 在 java.lang.Class.forName0(Native Method)[:1.7.0_75] 在 java.lang.Class.forName(Class.java:191)[:1.7.0_75] 在 org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:193) 在 org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:133) ... 58 更多 2015-02-17 18:11:52,704 | 信息 | agent-1-thread-1 | 部署代理 | io.fabric8.agent.DeploymentAgent 741 | 60 - io.fabric8.fabric-agent - 1.0.0.redhat-379 | org.hibernate.osgi / 4.3.6.Final 2015-02-17 18:11:52,713 | 信息 | agent-1-thread-1 | 部署代理 | io.fabric8.agent.DeploymentAgent 753 | 60 - io.fabric8.fabric-agent - 1.0.0.redhat-379 | 完毕。