CKK
CKK

Reputation: 49

Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.Table

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1236)

The following method did not exist:

    javax.persistence.Table.indexes()[Ljavax/persistence/Index;

The method''s class, javax.persistence.Table, is available from the following locations:

    jar:file:/C:/jboss-eap-6.4.0/jboss-eap-6.4/modules/system/layers/base/javax/persistence/api/main/hibernate-jpa-2.0-api-1.0.1.Final-redhat-3.jar!/javax/persistence/Table.class
    vfs:/C:/jboss-eap-6.4.0/jboss-eap-6.4/bin/content/bancaws.war/WEB-INF/lib/javax.persistence-api-2.2.jar/javax/persistence/Table.class

It was loaded from the following location:

    jar:file:/C:/jboss-eap-6.4.0/jboss-eap-6.4/modules/system/layers/base/javax/persistence/api/main/hibernate-jpa-2.0-api-1.0.1.Final-redhat-3.jar!/


Action:

Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.Table

Please help to resolve the above the issue.


<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>xxxx</groupId>
   <artifactId>xxxx</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>war</packaging>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.1.7.RELEASE</version>
   </parent>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
         <version>2.1.7.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <version>1.0.0.Final</version>
      </dependency>
      <!-- testing dependency -->
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
         <exclusions>
            <exclusion>
               <groupId>junit</groupId>
               <artifactId>junit</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
      <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-api</artifactId>
         <version>5.3.2</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-engine</artifactId>
         <version>5.3.2</version>
         <scope>test</scope>
      </dependency>
      <!--Oracle JDBC -->
      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>ojdbc8</artifactId>
         <version>18.3</version>
      </dependency>
      <!-- HikariCP connection pool -->
      <dependency>
         <groupId>com.zaxxer</groupId>
         <artifactId>HikariCP</artifactId>
         <version>2.6.0</version>
      </dependency>
      <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-web</artifactId>
         <version>5.1.9.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>javax</groupId>
         <artifactId>javaee-api</artifactId>
         <version>8.0</version>
         <scope>provided</scope>
      </dependency>
   </dependencies>
   <build>
      <finalName>xxxx</finalName>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
               <source>1.8</source>
               <target>1.8</target>
            </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.2.1</version>
            <configuration>
               <warSourceDirectory>WebContent</warSourceDirectory>
            </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.0</version>
         </plugin>
      </plugins>
   </build>
</project>

Upvotes: 1

Views: 13996

Answers (1)

Kavitha Karunakaran
Kavitha Karunakaran

Reputation: 1400

This error is caused due to version conflict of dependency jars. I found that you are using hibernate-jpa-2.1-api in your pom.xml and it is conflicting with the following as your error message says:

jar:file:/C:/jboss-eap-6.4.0/jboss-eap-6.4/modules/system/layers/base/javax/persistence/api/main/hibernate-jpa-2.0-api-1.0.1.Final-redhat-3.jar!/

It seems to me that your JBoss version supports hibernate jpa version 2.0. So if you are not explicitly using any interfaces out of the 2.1 jpa version in your code, you can try to remove the following dependency:

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

If you intend to use jpa version 2.1, probably you need to deploy your war into a web container that supports that version.

Upvotes: 3

Related Questions