36

I am developing a Spring/Vaadin/Hibernate application.

Everything works but I still have the following error markers in Eclipse STS 2.8.1:

The hierarchy of the type BankView is inconsistent
The hierarchy of the type AbstractEntityView is inconsistent

I have the following structure for my views:

public class BankView extends AbstractEntityView {  
    @Resource private BankService bankService;

    public void buildLayout() {
        super.buildLayout();

        // Use of the service here
    }
}

public abstract class AbstractEntityView extends AbstractView {  
    public void buildLayout() {
         verticalLayout = new VerticalLayout();
         verticalLayout.setSpacing(true);
         verticalLayout.setSizeFull();
         setContent(verticalLayout);
         super.buildLayout();
    }
}

@Configurable(preConstruction = true)
public abstract class AbstractView extends com.vaadin.ui.VerticalLayout {  
    public AbstractView() {
        super();
        try {
                buildLayout();
        }
        catch (AccessDeniedException e) { // Spring Security
                System.out.println("GTFO !");
        }
    }
}

What is causing these error markers?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
c4k
  • 4,270
  • 4
  • 40
  • 65
  • 2
    That error message is generally because of a bad classpath. Try rebuilding the whole project, that usually gives a more useful error, – skaffman Mar 09 '12 at 12:53
  • First, thanks for the answer ;) I've already tried to build it, nothing has changed. I tried Project > Clean... it didn't work. In my classpath, I tried to change the order of libraries, nothing changed :/ – c4k Mar 09 '12 at 13:30
  • 1
    possible duplicate of [Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistent](http://stackoverflow.com/questions/8520090/eclipse-compilation-error-the-hierarchy-of-the-type-class-name-is-inconsisten) – Angelo.Hannes Jun 03 '15 at 08:17

14 Answers14

50

In my case, I found the The hierarchy of the type ... is inconsistent error in Eclipse being caused by a jar file class from which I was extending my class referencing a class that was not in the build path.

So if you have:

// in other.dep.jar
class FromOtherDepJar {}

// in dep.jar
class FromDepJar extends FromOtherDepJar {}

// in the current project
class ProblematicClass extends FromDepJar {}

If dep.jar is in the project's classpath, but other.dep.jar isn't, Eclipse will show the The hierarchy of the type ... is inconsistent error.

Take a look at the Problems View in Eclipse, the Description column is more verbose about what the actual problem is than the hover-over.

Alex
  • 10,470
  • 8
  • 40
  • 62
  • I was getting "The hierarchy of the type GreetTheWorldFixture is inconsistent" while tryint the fitnesse tutorial, turns out I was missing the fitnesse.jar in my projects classpath, thanks for the answer! – Sinisha Mihajlovski Nov 24 '12 at 15:30
  • 1
    @GáborLipták link removed, IIRC it stated same cause for the problem – Alex Aug 14 '13 at 14:24
1

Reconfigure Build Path to solve the problem.

1

Did you tried to close and open eclipse? Sometimes it helps. My eclipse (probably because I am in a Windows platform) often shows errors like that, the only solution is to exit eclipse and reopen later.

rotterick
  • 384
  • 2
  • 5
1

In fact the problem was because I made AbstractListView @Configurable. When I put this annotation on the final class (for example BankView), all the errors disappeared.

Thanks everyone for the help. If someone has the same error they will find a solution in the different answers.

c4k
  • 4,270
  • 4
  • 40
  • 65
1

Another cause is a reference to a superclass or superinterface that exists, but is in a different package, and is neither imported nor fully qualified.

This occurred to me after using Eclipse refactoring to move abstract classes that inherited from a nested interface. After the move, all the subclasses had the "hierarchy of the type X is inconsistent" message. The problem was solved by importing by hand in the abstract classes that had been moved.

Andy Thomas
  • 84,978
  • 11
  • 107
  • 151
1

My problem was that classes/jars were recompiled manually outside of Eclipse using ant and gradle tasks. Refreshing all projects and rebuilding in eclipse made the errors disappear.

jp093121
  • 1,752
  • 19
  • 13
0

Their is a possibility your maven dependencys are not recognized. See if you have Maven enabled for this particular project. In Eclipse Maven can be actived by right clicking on the project and chosing Maven -> Enable Maven dependencys.

Th 00 mÄ s
  • 3,776
  • 1
  • 27
  • 46
0

In my case I was using the wrong JRE version.

Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
0

I had this problem when I added actionbarsherlock to my android project and forgot to remove support-library from my original project. Solution is to remove android-support-v4.jar from your project and clean the project.. it should load the library from actionbarsherlock folder.

vanomart
  • 1,739
  • 1
  • 18
  • 39
0

I know this probably is not the case here, but just for the additional information this error may be caused when using a hierarchy of interfaces and there is some error (such as wrong generics) somewhere higher in your hierarchy

stikku
  • 536
  • 7
  • 27
0

This error also shows up when android-support library mismatch occurs i.e when two external libraries that you use have two versions of support library this error shows, (what i did was i made them both same versions by deleting one and copying the support from other third party library to this one)

George Thomas
  • 4,566
  • 5
  • 30
  • 65
0

I solved this error The hierarchy of the type ServiceController is inconsistent problem by removing all Referenced Libraries of jars in Build Path and re add all jars in eclipse IDE.

UdayKiran Pulipati
  • 6,579
  • 7
  • 67
  • 92
0

I solved this problem by add javax.servlet-api-3.0.1.jar. my development tool is Eclipse ,but my project was developed under the myeclipse ,then when i import the project into eclipse ,it throws "the hierarchy of the type SysUserFilter is inconsistent",so i think myeclipse automatically provides javax.servlet-api-3.0.1.jar,but eclipse not.so it need to manually import .

ZhaoJing
  • 1
  • 4
0

Go and actually check your build path (Project properties => Java Build Path => Libraries) and the dialog might show you that something is missing. This was my problem, where the project was working but then after a month or two it stopped working because my JRE setup changed.

Andrew
  • 5,839
  • 1
  • 51
  • 72