u013749444
近了
采纳率0%
2017-03-18 14:26 阅读 1.5k

spring4 hibernate5 struts2 整合时出现异常该怎么解决,求各位大神帮帮忙

1

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in class path resource
[applicationContext.xml]: Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.orm.hibernate5.LocalSessionFactoryBean]:
No default constructor found; nested exception is
java.lang.UnsupportedClassVersionError: org/hibernate/cfg/Configuration
: Unsupported major.minor version 52.0 (unable to load class
org.hibernate.cfg.Configuration)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • u012571912 ?????| 2017-03-18 15:54

    你的SQL驱动用的mysql的,你看下你的db配置是不是有问题。我之前遇到的问题就是因为用的SQL配置与驱动JAR包不一直导致的

    点赞 1 评论 复制链接分享
  • u013749444 近了 2017-03-18 14:28

    别人说是jdk版本不对,我都换过了,还是没有用,是不是jar包的问题呢?

    点赞 评论 复制链接分享
  • u013749444 近了 2017-03-18 14:39

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

     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
        <property name="jdbcUrl" value="jdbc:mysql:///ssh_crm"></property>
        <property name="user" value="root"></property>
        <property name="password" value="root"></property>
     </bean>
    
     <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
        <property name="configLocations" value="classpath:hibernate.cfg.xml"></property>
     </bean>
    
     <!-- 事务管理 -->
     <bean id="transactionManager" 
        class="org.springframework.orm.hibernate5.HibernateTransactionManager"></bean>
     <tx:annotation-driven transaction-manager="transactionManager"/>
    
    
     <bean id="userAction" class="action.UserAction" scope="prototype">
        <property name="userService" ref="userService"></property>
     </bean>
    
     <bean id="userService" class="service.UserService">
        <property name="userDao" ref="userDaoImpl"></property>
     </bean>
    
     <bean id="userDaoImpl" class="dao.UserDaoImpl">
        <property name="hibernateTemplate" ref="hibernateTemplate"></property>
     </bean>
    
     <bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate">
        <property name="sessionFactory" ref="sessionFactory"></property>
     </bean>
    

    点赞 评论 复制链接分享
  • u013749444 近了 2017-03-18 14:41

    图片说明

    点赞 评论 复制链接分享
  • LZW190 2020回归技术 2017-03-20 08:02

    代码的编译版本不对,不是jdk版本

    点赞 评论 复制链接分享

相关推荐