org.springframework.orm.hibernate4.HibernateTransactionManager找不到hibernate 4

时间:2016-06-27 11:25:35

标签: spring oracle hibernate weblogic

我使用Spring 3.2.6,Hibernate 4,oracle,maven和weblogic。

我将Hibernate配置为与oracle和weblogic一起使用。但是当我在weblogic中部署我的项目时,我得到以下消息

$ cut -d' ' -f-5 <<< "Hello, this is a sentence with a few words."Hello, this is a sentence

我检查了我的maven依赖项,我看到了这个类。我不知道为什么我的hibernate-context没有找到这个类。我认为错误可能是其他错误。但我不知道如何配置hibernate-context.xml

我的hibernate-context.xml是

Caused By: java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.HibernateTransactionManager
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Truncated. see log file for complete stacktrace

依赖关系是:

enter image description here

pom.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:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
   http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/tx 
   http://www.springframework.org/schema/tx/spring-tx.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd
   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
      ">

    <!-- Enable annotation style of managing transactions -->
    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean name="sessionFactory" id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
        p:packagesToScan="eusurvey.controller,eusurvey.daos.implementacion">

        <property name="dataSource" ref="dataSource" />
        <property name="hibernateProperties">
            <props>

               ..........
            </props>
        </property>
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${app.jdbc.driverClassName}" />
        <property name="url" value="${app.jdbc.url}" />
        <property name="username" value="${app.jdbc.username}" />
        <property name="password" value="${app.jdbc.username}" />
    </bean>

    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager"
        p:sessionFactory-ref="sessionFactory" />


</beans>

0 个答案:

没有答案