score:177

Accepted answer

it means you are trying to implement a non-existing interface or you're extending an non-existing class.

try to refresh your eclipse.

if it doesn't work, it may mean that you have a reference to a jar that is not in the build path. check your project's classpath and verify that the jar containing the interface or the class is in it.

score:0

for me it was changing the android api level to one with google apis

score:0

i was having this problem too... i found out that the hierarchy of the class that was throwing this exception, cannot be traced all way back to its root class by eclipse... i explain:

in my case, i have 3 java project: a, b and c... where a and b are maven projects and c a regular java eclipse project...

in the project a, i have the interface "interfacea" ... in the project b, i have the interface "interfaceb" that extends "interfacea" in the project c, i have the concrete class "classc" that implements "interfaceb"

the "project c" was including the "project b" in its build path but not "project a" (so that was the cause of the error).... after including "project a" inside the build path of "c", everything went back to normal...

score:0

i had a class that extends labelprovider in a project with osgi, there the error occured. the solution was: adding org.eclipse.jface to the required plugins in the manifest.mf instead of importing the single packages like org.eclipse.jface.viewers

score:0

if you are importing the eclipse project just 1. go to the java build path setting under the project properties. 2. in case the jre system library has an error sign attach to it double click it to open the edit library window 3. change the execution environment to the correct java version of the system or choose edit the other settings by checking the radio buttons assign to them. 4. click finish

score:0

when importing a gwt project in eclipse without installing "google plugin for eclipse", this will occur. after installing "google plugin for eclipse", this error will disappear.

score:0

right click on the project folder and select "java build path". under "java build path" you should be able to see libraries. eclipse will show errors in any of those libraries. fixing those issue will help to resolve the issue.

score:0

i had this error after doing some git merge from a branch where my classes extended a new interface. it was enough to refresh (f5) the file-tree in the package explorer frame of eclipse.

it seems that eclipse did not update everything properly and so the classes were extending a non-existing-yet interface. after refresh, all errors disappeared.

score:0

i had to switch from eclipse oxygen that i got from ibm and used ibm jdk 8 to eclipse photon and oracle jdk 8. i'm working on java customizations for .

score:1

to me, the issue was due to wrong imports. in fact, one need to update the imports after adding the v7 support library.

it can be fixed by doing as follows, for each class of your project:

  1. delete all the lines with import android.[*], in each class
  2. reorganize your imports: from the context menu select source/organize imports or (ctrl+shift+o)
  3. when prompted, select the libraries android.support.[*] (and not android.[*]).

score:1

it was definitely because missing dependencies that were not in my maven pom.xml.

for example, i wanted to create integration tests for my implementation of the broadleaf ecommerce demo site.

i had included a broadleaf jar with integration tests from broadleaf commerce in order to reuse their configuration files and base testing classes. that project had other testing dependencies that i had not included and i received the "inconsistent hierarchy" error.

after copying the "test dependencies" from broadleaf/pom.xml and the associated properties variables that provided the versions for each dependency in broadleaf/pom.xml, the error went away.

the properties were:

    <geb.version>0.9.3</geb.version>
    <spock.version>0.7-groovy-2.0</spock.version>
    <selenium.version>2.42.2</selenium.version>
    <groovy.version>2.1.8</groovy.version>

the dependencies were:

<dependency>
            <groupid>org.broadleafcommerce</groupid>
            <artifactid>integration</artifactid>
            <type>jar</type>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.broadleafcommerce</groupid>
            <artifactid>broadleaf-framework</artifactid>
            <version>${blc.version}</version><!--$no-mvn-man-ver$ -->
            <classifier>tests</classifier>
        </dependency>
        <dependency>
            <groupid>com.icegreen</groupid>
            <artifactid>greenmail</artifactid>
            <version>1.3</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>junit</groupid>
            <artifactid>junit</artifactid>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.easymock</groupid>
            <artifactid>easymock</artifactid>
            <version>2.5.1</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.easymock</groupid>
            <artifactid>easymockclassextension</artifactid>
            <version>2.4</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.testng</groupid>
            <artifactid>testng</artifactid>
            <version>5.9</version>
            <type>jar</type>
            <classifier>jdk15</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.codehaus.groovy</groupid>
            <artifactid>groovy-all</artifactid>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.gebish</groupid>
            <artifactid>geb-core</artifactid>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.gebish</groupid>
            <artifactid>geb-spock</artifactid>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.spockframework</groupid>
            <artifactid>spock-core</artifactid>
            <version>${spock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.seleniumhq.selenium</groupid>
            <artifactid>selenium-support</artifactid>
            <version>${selenium.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.seleniumhq.selenium</groupid>
            <artifactid>selenium-firefox-driver</artifactid>
            <version>${selenium.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupid>org.seleniumhq.selenium</groupid>
            <artifactid>selenium-chrome-driver</artifactid>
            <version>${selenium.version}</version>
            <scope>test</scope>
        </dependency>
  <!-- logging -->
            <dependency>
                <groupid>log4j</groupid>
                <artifactid>log4j</artifactid>
                <version>1.2.12</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupid>org.slf4j</groupid>
                <artifactid>slf4j-log4j12</artifactid>
                <version>1.6.1</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupid>org.slf4j</groupid>
                <artifactid>jcl-over-slf4j</artifactid>
                <version>1.6.1</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupid>org.slf4j</groupid>
                <artifactid>slf4j-api</artifactid>
                <version>1.6.1</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupid>org.hsqldb</groupid>
                <artifactid>hsqldb</artifactid>
                <version>2.3.1</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>

score:1

if the extended class has the issue then the above error message will gets displayed.

example

class example extends example1 {

}

fix the issues in example1

score:1

i had the same exact problem marker and solved it by removing the @override annotation from a method that was in fact the first implementation (the "super" one being an abstract method) and not an override.

score:1

in my case, the import references in many of the classes contained an extra word. i solved it by editing all the files to have the correct imports. i started doing the edits manually. but when i saw the pattern, i automated it with a find..replace in eclipse. this resolved the error.

score:2

you will see this error in case a some class in your library file you have in classpath has reference to non-existing classe(s) which could be in another jar file. here, i received this error when i did not add org.springframework.beans-3.1.2.release.jar and had extended a class from org.springframework.jdbc.core.support.jdbcdaosupport, which was in org.springframework.jdbc-3.1.2.release.jar of my classpath.

score:2

the problem may be that you have included incorrect jars. i had the same problem and the reason was that i had included incorrect default jre library in the build path of the project. i had installed java with another version and was including jre files of java with a different version. (i had installed jre 1.6 in my system and was having jre library 1.7 included in the build path due to previously installed java) may be you can check if the jre library that you have included in the build path is of correct version ie. of java version that you have installed in your system.

score:2

i 've experienced this problem on eclipse juno, the root cause was that although some spring jars were being included by transient maven dependencies they were included in incorrect versions.

so you should check if using a modularized framework as spring that every module (or at least the most important: core, beans, context, aop, tx, etc.) are in the same version.

to solve the problem i 've used maven dependnecy exclusions to avoid incorrect version of transient dependencies.

score:2

error : the hierarchy of the type "class name" is inconsistent error.

solution : class otherdepjar {} --> is inside "other.dep.jar" .

class depjar extends otherdepjar {} --> is inside "dep.jar".

class problematicclass extends depjar {} --> is inside current project .

if dep.jar is in the project's classpath, but other.dep.jar isn't in the project's classpath, eclipse will show the" the hierarchy of the type ... is inconsistent error"

score:5

i had this problem after i upgraded the jdk to a new version. i had to update the references to libraries in project properties/java build path.

score:5

one more case i have had. give the correct project path, and import it to eclipse.

then go to project--> clean --> clean all projects.

score:5

you should clean the project , or restart eclipse.

score:13

check your errors (tab "markers"). i had also the following error:

archive for required library in project cannot be read...

and when that was fixed the "inconsistent-error" disappeared.

actually i had added jars to the build path, but for some reason they could not be read with error

archive for required library in project cannot be read or is not a valid zip file

so instead i added them as "external jars". that helped and all compilation problems were no more!

score:16

sometimes it happens when you add a jar that you need, but don't include the jars that it needs. in my case adding all the jars in tomcat/lib helped me to solve this problem. i am working on a web-app.


Related Query