簡體   English   中英

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

[英]java.lang.NoClassDefFoundError: org/hibernate/cache/RegionFactory

我在使用Hibernate 3.0創建的應用中遇到此錯誤(我只能使用此版本)

org.eclipse.jetty.servlet.ServletHolder $ 1:
org.springframework.beans.factory.BeanCreationException:
創建名稱為'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0'的bean時出錯:
調用init方法失敗; 嵌套異常為
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。

從Hibernate 3.3開始可以使用org.hibernate.cache.RegionFactory。 您需要從路徑中刪除舊版本的Hibernate的jar文件,並使用新版本。 如果您正在使用Maven或Ivy之類的組件管理器,只需刪除依賴項並將其替換為較新的版本即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM