gpt4 book ai didi

java.lang.NoClassDefFoundError : org/hibernate/cache/RegionFactory

转载 作者:太空宇宙 更新时间:2023-11-04 13:34:35 24 4
gpt4 key购买 nike

我在使用 Hibernate 3.0 创建的应用程序中遇到此错误(我只能使用此版本)

org.eclipse.jetty.servlet.ServletHolder$1:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0':
Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError: org/hibernate/cache/RegionFactory

调度程序-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

<mvc:annotation-driven/>

<context:annotation-config />

<context:component-scan base-package="com.company"/>

<mvc:default-servlet-handler/>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>

<bean name="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>

hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="factory">
<property name="connection.datasource">java:comp/env/jdbc/TestDB</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
<mapping class="com.company.model.Organization" />
</session-factory>

我该如何解决这个问题?看起来升级到 Hibernate 4 可以解决这个问题,但我需要 Hibernate 3.0。

最佳答案

org.hibernate.cache.RegionFactory 从 Hibernate 3.3 开始可用。您需要从路径中删除旧版本的 Hibernate jar 文件并使用较新的版本。如果您使用 Maven 或 ivy 等组件管理器,只需删除依赖项并将其替换为更新的版本即可。

关于java.lang.NoClassDefFoundError : org/hibernate/cache/RegionFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31836357/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com