michaeln peterson
michaeln peterson

Reputation: 175

How to setup hibernate3 with Jboss7?

I'm trying to set up a Spring MVC + Hibernate WAR for deployment to Jboss 7.1.1 Final. My application using Hibernate 3.6.1 & So far my understanding is that Hibernate 4 is packaged with the AS and is the default persistence provider. I am not using persistent.xml file configuration.

I have provided all required java still I am still getting following exception, Can anyone help me to setup hibernate 3 related changes in JBoss?

03:14,597 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-3)  
Context initialization failed:  
org.springframework.beans.factory.BeanCreationException:  
Error creating bean with name 'hibernateVendor' defined in ServletContext resource [/WEB-INF/hibernate-context.xml]:  
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:  
Could not instantiate bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]:  
Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence

Upvotes: 1

Views: 92

Answers (1)

jalpa
jalpa

Reputation: 204

Since you get a java.lang.NoClassDefFoundError (and not a ClassNotFoundException), it's probably some sort of classloading issue.

try adding hibernate-entitymanager dependency that will solve your problem.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>${hibernate.version}</version>
    <exclusions>
        <exclusion>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
        </exclusion>
        <exclusion>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Upvotes: 2

Related Questions