【发布时间】:2021-03-11 00:33:30
【问题描述】:
我在使用 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>
请帮我解决这个错误以及这个错误的原因。任何帮助表示赞赏,谢谢
【问题讨论】:
标签: java spring hibernate dao sessionfactory