2

I'm getting this error in my app, created with Hibernate 3.0 (I can only use this version)

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

dispatcher-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>

How can I fix it? It seem like it might be solved by upgrading to Hibernate 4, but I need Hibernate 3.0.

Don't Panic
  • 41,125
  • 10
  • 61
  • 80
Nastasia
  • 53
  • 1
  • 6

1 Answers1

0

org.hibernate.cache.RegionFactory is available from Hibernate 3.3 onward. You'll need to remove the older version of Hibernate's jar files from the path and use the newer version. If you are using component managers like Maven or ivy, simply remove the dependency entry and replace it with a newer version.

Amir Keibi
  • 1,991
  • 28
  • 45