无法初始化组定义组资源名称-hibernate中的会话工厂

lf5gs5x2  于 2021-07-07  发布在  Java
关注(0)|答案(1)|浏览(367)

我在使用hibernate时遇到以下错误。你能找出这个错误的原因吗。

org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. 
 Group resource name [classpath*:beanRefFactory.xml], factory key [BeanFactory]; nested exception 
 is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
 'BeanFactory' defined in URL [jar:file:/E:/Client/ 
 post/test.jar!/beanRefFactory.xml]: Instantiation of bean failed; nested exception 
 is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class 
 [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; 
 nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean 
 with name 'SessionFactory' defined in class path resource [applicationContext.xml]: Invocation of 
init method failed; nested exception is java.lang.VerifyError: class 
net.sf.cglib.core.DebuggingClassWriter overrides final method 
org.objectweb.asm.ClassWriter.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String; 
[Ljava/lang/String;)V
at 
org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389)
....
....
....
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method org.objectweb.asm.ClassWriter.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:108)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
... 155 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method org.objectweb.asm.ClassWriter.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V

我在applicationcontext.xml文件中定义了如下会话工厂bean,并从单独的文件database.properties获取数据库连接值。

<bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="JobDataSource" />
    <property name="mappingResources">
        <list>

            <value>Entry.hbm.xml</value>
            <value>AccountMapping.hbm.xml</value>

        </list>
    </property>
    <property name="hibernateProperties">
         <props>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
         </props>
    </property>
</bean>

请帮助我解决这个错误和这个错误的原因。谢谢你的帮助

jfgube3f

jfgube3f1#

cglib预期的asm版本与运行时使用的版本不同。看起来您可能弄乱了依赖关系或使用了不兼容的版本。

相关问题