当前位置: 首页 > 知识库问答 >
问题:

karaf OSGI中的实体类加载问题

赏彭薄
2023-03-14

我正在进行一个使用

spring 3.2.5 .发布hibernate 4.2.15 .最终版karaf 3.0.x

安装自定义包(包含所有实体类)时,<code>抛出PersistentClass名称不能转换为类</code>异常

请在下面找到我的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.html" target="_blank">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

我不能解决这个问题。如果任何人有想法,请与我分享

谢谢

戈比

编辑日期:2016年4月4日

我仍然无法解决.....

现在我把Spring升级到

Apache ServiceMix:: 捆绑4.2.5.RELEASE_1和hibernate-core4.3.6.Final

但是同样的问题。

原因:Configuration.java:1928:PeristentClass name无法在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.initializeBeanAbstractAutowireCapableBeanFactory.java:1574(Configuration.java:3788)org.hibernate.cfg.ConfigurationMetadataSourceQueue.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(org.hibernate.AssertionFailure)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)

相同的捆绑包能够部署在virgo osgi服务器中。因此,我确信Hibernate配置不是问题。缺少一些支持库。

如果有人使用karaf 3.x和hibernate,请分享您的

捆绑:列表

我会和我的比较。

提前感谢您。

共有1个答案

巴帅
2023-03-14

这似乎是根本原因:

原因:org.hibernate.core找不到Java . lang . classnotfoundexception:com . sample . model . country[94]

没有看到清单或输出

猴子

没有什么别的事可做了。

最有可能的是,您缺少com.sample.model的导入包条目

 类似资料:
  • 我有以下情况: 我想把所有动物都放在动物桌上。但是当我加载它们时,我想说它们是在哪个子类中加载的。在这种情况下,动物在理论上是抽象的。 这样的事情可能吗: 问题是,否则我看不出有任何可能从装载的动物投射到猫。:( 我用的是Hibernate4.2

  • 问题内容: 我使用了来自Maven回购的log4j-1.2.17捆绑包。我尝试在捆绑软件中执行此代码(我的捆绑软件调用了log4j-1.2.17捆绑软件) 但是我有错误 捆绑包已按顺序加载 如何解决这个错误?拜托,对不起我的英语。最好的问候,亚瑟。 问题答案: 由于您的Log4j类似乎已由sun.misc类加载器加载,我认为某些东西正在从OSGi外部提供log4j类。有Log4J条目解释了为什么它

  • 我有一个运行在Tomcat 8(Windows 10,JRE 1.8.0_111)上的web应用程序,它实现了一个REST客户端,用于与第三部分REST服务(ADLNET xAPI LRS)通信 当我最近在不同的服务器(CentOS、Tomcat8、Java1.8.0.11)上部署该WAR文件时,应用程序会给出一个ClassNotFound异常: java.lang.ClassNotFoundEx

  • 我使用Hibernate已经有一段时间了,而且非常成功。然而,我昨天遇到了一个问题,这里的答案将在将来节省大量调试时间。 我忘了在我的hibernate中添加hibernate映射。新实体的cfg。 当我试图加载这个实体时,我本以为会得到某种运行时异常,但它却什么也没加载,继续运行,好像一切都很好。 我正在使用以下代码加载实体。 我想一个错误,如果我尝试加载一个实体,没有映射在我的hibernat

  • 我对Weblogic类加载器有问题。 当我尝试在WL 12.2.1.2.0上部署我的应用程序时,它失败了。在我服务器上的日志中,我看到了 该类属于xml API库。库进入我的应用程序时带有另一个依赖项(即传递依赖项)。xml API的版本是1.4.01。 之后,我在部署描述符中添加了异常: 然后是一个新的部署。所述问题与组织有关。w3c。dom。元素遍历已解决。没有关于缺少组织的任何信息。w3c。

  • 我正在利用mongoose类模式。 并为我的 Node 项目使用 TypeScript。 为了确保我的模型知道我定义的模式,所以我有自动完成等。 然而,模式类变得更加棘手。正如他们文件中所写的: loadclass()函数允许您从ES6类中提取方法、静态和虚拟化。类方法映射到模式方法,静态方法映射到模式静态,getters/setters映射到虚拟化。 所以我的代码看起来像: 我的目标是TypeS