调用rest web服务时发生hibernate错误

iswrvxsc  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(175)

http状态500-org.glassfish.jersey.server.containerexception:java.lang.nosuchmethoderror:org.hibernate.jpa.internal.util.configurationhelper.getflushmode(ljava/lang/object;lorg/hibernate/flushmode;)lorg/休眠/刷新模式;
每次我在我的服务器(ovh)中调用postman上的端点时都会出现此错误。mysql server的版本是mysql 5.7注意:在localhost中,它工作得很好
这是我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.expenseIt</groupId>
  <artifactId>ExpenseAPI</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>ExpenseAPI</name>
  <url>http://maven.apache.org</url>
<dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.bundles/jaxrs-ri -->
        <dependency>
            <groupId>org.glassfish.jersey.bundles</groupId>
            <artifactId>jaxrs-ri</artifactId>
            <version>2.25</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-moxy -->
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
            <version>2.25</version>
        </dependency>

        <!-- Hibernate Dependencies -->
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.8.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.4.0.Final</version>
        </dependency>

        <!-- MySQL Dependencies -->
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.41</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>5.2.12.Final</version>
        </dependency>

        <dependency>
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.1-api</artifactId>
    <version>1.0.0.Final</version>
</dependency>

        <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-ses -->
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-ses</artifactId>
            <version>1.11.232</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.7</version>
        </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
      <version>4.3.4.RELEASE</version>
      <type>jar</type>
    </dependency>
</dependencies>

  <build>
    <finalName>ExpenseAPI</finalName>
  </build>
</project>

这是我的hibernate配置文件

<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/expensedb?zeroDateTimeBehavior=convertToNull</property>
        <property name="hibernate.connection.username">**</property>
        <property name="hibernate.connection.password">**</property>

        <property name="hibernate.id.new_generator_mappings">true</property>  
        <property name="show_sql">true</property> 
        <property name="hibernate.hbm2ddl.auto">update</property>

        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.max_size">25</property>
        <property name="hibernate.c3p0.timeout">300</property>
        <property name="hibernate.c3p0.max_statements">50</property>

        <mapping class="io.entities.UserEntity"></mapping> 
        <mapping class="io.entities.DividasEntity"></mapping> 
        <mapping class="io.entities.GastosEntity"></mapping> 
         <mapping class="io.entities.LimiteGastosEntity"></mapping> 

    </session-factory>
</hibernate-configuration>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题