karaf OSGI

时间:2016-03-25 17:33:12

标签: spring hibernate osgi karaf

我正在使用

的项目

春天3.2.5.RELEASE 休眠4.2.15.Final karaf 3.0.x

当我安装自定义捆绑包(包含所有实体类)时,throwing PersistentClass name cannot be converted into a Class异常

请在下面找到我的karaf捆绑列表

 ID | State    | Lvl | Version            | Name                                                                      
-------------------------------------------------------------------------------------
 84 | Active   |  80 | 2.7.7.5            | Apache ServiceMix :: Bundles :: antlr                                     
 85 | Active   |  80 | 1.8.2.2            | Apache ServiceMix :: Bundles :: ant                                       
 86 | Active   |  80 | 1.6.1.5            | Apache ServiceMix :: Bundles :: dom4j                                     
 87 | Active   |  80 | 1.14.1.1           | Apache ServiceMix :: Bundles :: serp                                      
 88 | Active   |  80 | 1.1.0              | ClassMate                                                                 
 89 | Active   |  80 | 3.18.1.GA          | Javassist                                                                 
 90 | Active   |  80 | 1.0.2.Final        | JACC 1.4 API                                                              
 91 | Active   |  80 | 1.2.2.Final        | Java Annotation Indexer                                                   
 92 | Active   |  80 | 3.1.4.GA           | JBoss Logging 3                                                           
 93 | Active   |  80 | 4.0.4.Final        | hibernate-commons-annotations                                             
 94 | Active   | 100 | 4.2.15.Final       | hibernate-core                                                            
 95 | Active   | 100 | 4.2.15.Final       | hibernate-entitymanager                                                   
 96 | Active   | 100 | 4.2.15.Final       | hibernate-osgi                                                            
294 | Active   |  80 | 3.2.5.RELEASE      | Spring Context                                                            
295 | Active   |  80 | 3.2.5.RELEASE      | Spring Core                                                               
296 | Active   |  80 | 3.2.5.RELEASE      | Spring Expression Language                                                
297 | Active   |  80 | 3.2.5.RELEASE      | Spring Transaction                                                        
298 | Active   |  80 | 1.2.17             | Apache Log4j                                                              
299 | Active   |  80 | 1.7.5              | slf4j-api, Fragments: 300                                                 
300 | Resolved |  80 | 1.7.5              | slf4j-log4j12, Hosts: 299                                                 
302 | Active   |  80 | 0                  | wrap_mvn_org.springframework.amqp_spring-amqp_1.2.2.RELEASE               
303 | Active   |  80 | 0                  | wrap_mvn_org.springframework.amqp_spring-rabbit_1.2.2.RELEASE             
304 | Active   |  80 | 3.2.5.RELEASE      | Spring ORM                                                                
305 | Active   |  80 | 1.0.0              | AOP Alliance API                                                          
306 | Active   |  80 | 3.2.5.RELEASE      | Spring JDBC                                                               
307 | Active   |  80 | 8.3.603            | PostgreSQL JDBC3 Driver                                                   
308 | Active   |  80 | 0.9.1.2            | c3p0 Connection Pool                                                      
309 | Active   |  80 | 2.0.0              | Java Persistence API                                                      
310 | Active   |  80 | 0                  | wrap_mvn_antlr_antlr_2.7.7                                                
311 | Active   |  80 | 3.1.0.GA           | JBoss Logging 3                                                           
312 | Active   |  80 | 0                  | wrap_mvn_dom4j_dom4j_1.6.1                                                
313 | Active   |  80 | 1.0.1.Final        | Java Transaction API                                                      
314 | Active   |  80 | 0                  | wrap_mvn_org.hibernate.javax.persistence_hibernate-jpa-2.0-api_1.0.1.Final
315 | Active   |  80 | 4.0.2.Final        | Hibernate Commons Annotations                                             
316 | Active   |  80 | 3.0.0              | Expression Language 3.0 API                                               
317 | Active   |  80 | 1.2                | javax.interceptor API                                                     
318 | Active   |  80 | 0                  | wrap_mvn_javax.inject_javax.inject_1                                      
319 | Active   |  80 | 1.2.0              | CDI APIs                                                                  
320 | Active   |  80 | 1.5.3              | Apache Commons Pool                                                       
321 | Active   |  80 | 1.7.2.RELEASE      | AspectJ Runtime                                                           
322 | Active   |  80 | 1.7.1.RELEASE      | AspectJ Weaver                                                            
323 | Active   |  80 | 1.1.0              | Java Transaction API                                                      
324 | Active   |  80 | 2.6.0              | Apache Commons Lang                                                       
325 | Active   |  80 | 1.3.1              | MaxMind GeoIP Legacy API                                                  
326 | Active   |  80 | 3.2.1              | Apache Commons Collections                                                
327 | Active   |  80 | 3.4.0              | Apache Commons Lang                                                       
328 | Active   |  80 | 2.3.2              | Jackson-annotations                                                       
329 | Active   |  80 | 0                  | wrap_mvn_commons-collections_commons-collections_3.2                      
330 | Active   |  80 | 1.0.1              | soautil                                                                   
331 | Active   |  80 | 0                  | wrap_mvn_logkit_logkit_1.0.1                                              
332 | Active   |  80 | 0                  | wrap_mvn_javax.servlet_servlet-api_2.3                                    
333 | Active   |  80 | 0                  | wrap_mvn_commons-logging_commons-logging_1.1                              
334 | Active   |  80 | 3.2.5.RELEASE      | Spring AOP                                                                
335 | Active   |  80 | 3.2.5.RELEASE      | Spring Beans                                                              
336 | Active   |  80 | 3.2.5.RELEASE      | Spring Web                                                                
337 | Active   |  80 | 0                  | wrap_mvn_org.springframework_spring-remoting_2.0.8                        
339 | Active   |  80 | 1.2.16             | Apache Log4J                                                              
340 | Active   |  80 | 2.3.18             | Freemarker Templating Engine                                              
341 | Active   |  80 | 1.0.1              | utils-spring                                                              
342 | Active   |  80 | 5.0.0.201203141902 | osgi.core                                                                 
343 | Active   |  80 | 1.2.1              | spring-osgi-io                                                            
344 | Active   |  80 | 1.2.1              | spring-osgi-core                                                          
345 | Active   |  80 | 1.2.1              | spring-osgi-extender                                                      
346 | Active   |  80 | 5.0.0.201305092017 | osgi.cmpn                                                                 
347 | Active   |  80 | 0.5.4              | FasterXML ClassMate                                                       
348 | Active   |  80 | 1.0.1              | MyServiceBundle    

查找以下异常

2016-03-26 01:04:41,934 | DEBUG | ExtenderThread-2 | OsgiBundleXmlApplicationContext  | 294 - org.springframework.context - 3.2.5.RELEASE | Post refresh error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'geoService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sample.repository.sampleRepository com.sample.impl.GeoServiceImpl.sampleRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.sample.repository.sampleRepository.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://348.0:0/spring-data.xml]: Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)[294:org.springframework.context:3.2.5.RELEASE]
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[344:org.springframework.osgi.core:1.2.1]
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[344:org.springframework.osgi.core:1.2.1]
    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[344:org.springframework.osgi.core:1.2.1]
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[344:org.springframework.osgi.core:1.2.1]
    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[345:org.springframework.osgi.extender:1.2.1]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.sample.repository.sampleRepository com.sample.impl.GeoServiceImpl.sampleRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.sample.repository.sampleRepository.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://348.0:0/spring-data.xml]: Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)[335:org.springframework.beans:3.2.5.RELEASE]
    ... 15 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.sample.repository.sampleRepository.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://348.0:0/spring-data.xml]: Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)[335:org.springframework.beans:3.2.5.RELEASE]
    ... 17 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.sample.repository.sampleRepository.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://348.0:0/spring-data.xml]: Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)[335:org.springframework.beans:3.2.5.RELEASE]
    ... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundle://348.0:0/spring-data.xml]: Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)[335:org.springframework.beans:3.2.5.RELEASE]
    ... 30 more
Caused by: org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class
    at org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:816)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2097)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:895)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:728)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3568)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3522)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1379)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784)[94:org.hibernate.core:4.2.15.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1868)[94:org.hibernate.core:4.2.15.Final]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)[304:org.springframework.orm:3.2.5.RELEASE]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)[304:org.springframework.orm:3.2.5.RELEASE]
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)[304:org.springframework.orm:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)[335:org.springframework.beans:3.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)[335:org.springframework.beans:3.2.5.RELEASE]
    ... 40 more
Caused by: java.lang.ClassNotFoundException: com.sample.model.Country not found by org.hibernate.core [94]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.2.1.jar:]
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.2.1.jar:]
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_71]
    at java.lang.Class.forName0(Native Method)[:1.7.0_71]
    at java.lang.Class.forName(Class.java:274)[:1.7.0_71]
    at org.hibernate.annotations.common.util.ReflectHelper.classForName(ReflectHelper.java:60)[93:org.hibernate.common.hibernate-commons-annotations:4.0.4.Final]
    at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.classForName(JavaReflectionManager.java:138)[93:org.hibernate.common.hibernate-commons-annotations:4.0.4.Final]
    at org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:812)[94:org.hibernate.core:4.2.15.Final]
    ... 53 more

我猜,实体类没有正确扫描。这是我的配置

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="hibernateProperties" ref="hibernateProperties"/>
    <property name="annotatedClasses">
        <list>
            <value>com.sample.model.Country</value>
            <value>com.sample.model.Location</value>
        </list>
    </property>
</bean>

<bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean> 

已编辑:

请查看以下清单标题条目

Manifest-Version = 1.0
Bnd-LastModified = 1458957186000
Tool = Bnd-2.4.0.201411031534
Spring-Context = /spring.xml
Created-By = 1.7.0_71 (Oracle Corporation)

Bundle-Vendor = demo
Bundle-Name = MyServiceBundle
Bundle-Description = MyService Bundle to create Amqp services
Bundle-SymbolicName = com.sample.MyServiceBundle
Bundle-Version = 1.0.1
Bundle-ManifestVersion = 2

Require-Capability = 
    osgi.ee;filter:=(&(osgi.ee=JavaSE)(version=1.7))

Import-Package = 
    com.maxmind.geoip;version="[1.3,2)",
    javax.persistence;version="[2.0,3)",
    org.hibernate;version="[4.2,5)",
    org.hibernate.annotations;version="[4.2,5)",
    org.hibernate.criterion;version="[4.2,5)",
    org.slf4j;version="[1.7,2)",
    org.springframework.beans.factory.annotation;version="[3.2,4)",
    org.springframework.context.support;version="[3.2,4)",
    org.springframework.stereotype;version="[3.2,4)",
    org.springframework.transaction.annotation;version="[3.2,4)",
    com.sample.api;version="[1.0,2)",
    com.sample.utils.soa.exception;version="[1.0,2)",
    org.springframework.amqp.rabbit.core,
    org.springframework.orm.hibernate4;version="[3.2,4)",
    com.mchange.v2.c3p0;version="[0.9,1)",
    org.springframework.aop;version="[3.2,4)",
    org.springframework.aop.framework;version="[3.2,4)",
    org.springframework.cglib.proxy;version="[3.2,4)",
    org.springframework.cglib.core;version="[3.2,4)",
    org.aopalliance.aop;version="[1.0,2)",
    org.springframework.amqp.rabbit.listener.adapter,
    org.springframework.amqp.remoting.service,
    com.sample.utils.spring;version="[1.0,2)",
    org.springframework.remoting.support;version="[3.2,4)",
    org.springframework.amqp.rabbit.transaction,
    org.springframework.cglib.reflect;version="[3.2,4)",
    org.springframework.jmx.export.annotation;version="[3.2,4)",
    org.springframework.amqp.support.converter,
    org.springframework.core.type;version="[3.2,4)",
    org.springframework.context;version="[3.2,4)",
    org.apache.felix.service.command,
    org.apache.felix.gogo.commands,
    org.apache.karaf.shell.console,
    org.apache.karaf.shell.commands,
    org.hibernate.cfg;version="[4.2,5)",
    org.hibernate.service;version="[4.2,5)",
    org.hibernate.proxy;version="[4.2,5)",
    javassist.util.proxy;version="[3.18,4)",
    com.sample.model;version="[1.0,2)"
Export-Package = 
    com.sample;uses:=com.sample.utils.soa.exception;version=1.0.1,
    com.sample.repository;
        uses:="org.hibernate,
            org.springframework.beans.factory.annotation,
            org.springframework.stereotype,
            org.springframework.transaction.annotation,
            com.sample.api,
            com.sample.model,
            com.sample.utils.soa.exception";
        version=1.0.1,
    com.sample.impl;uses:="org.springframework.stereotype,com.sample.api,com.sample.utils.soa.exception";version=1.0.1,
    com.sample.model;uses:=javax.persistence;version=1.0.1

我无法解决这个问题。如果有人有想法请与我分享

谢谢,

gopy

编辑:2016年4月4日

我还是无法解决.....

现在我升级到了

  

Apache ServiceMix :: Bundles 4.2.5.RELEASE_1和   hibernate-core 4.3.6.Final

但同样的问题。

  

引起:org.hibernate.AssertionFailure:PersistentClass名称不能   被转换成一个班级   org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:817)     在   org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2169)     在   org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)     在   org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)     在   org.hibernate.cfg.Configuration $ MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)     在   org.hibernate.cfg.Configuration $ MetadataSourceQueue.processMetadata(Configuration.java:3742)     在   org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)     在   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)     在   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)     在   org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372)     在   org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454)     在   org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

可以在virgo osgi服务器中部署相同的bundle。所以我确信hibernate配置不是问题。缺少一些支持库。

如果有人使用karaf 3.x进行休眠,请分享您的

  

束:列表

我将与我的相比。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

这似乎是根本原因:

  

引起:java.lang.ClassNotFoundException:org.hibernate.core找不到com.sample.model.Country [94]

没有看到清单或

的输出
  

karaf&GT;标头$ bundleId

没有太多其他事情要做。

最有可能的是,您缺少com.sample.model

的Import-Package条目