2011-12-15 39 views

回答

132

這意味着你正試圖實現一個不存在的接口,或者你正在擴展一個不存在的類。

嘗試刷新您的Eclipse。

如果它不工作,這可能意味着你必須一個JAR,是不是在構建路徑的參考。 檢查您的項目的類路徑並驗證包含接口或類的jar是否在其中。

+2

沿着類似的徒勞,我有一個Maven依賴關係,它導致了Spring Tool Suite中的這個錯誤,解決方案是在相關的依賴關係上執行`Maven`>`Download Source`。 – MrLore 2013-04-04 08:51:55

+0

讚賞你@lagrantmere – Shinchan 2013-06-13 10:07:43

9

檢查你的錯誤(標籤「標記」)。我也有以下錯誤:

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

並且當它被修復時,「不一致的錯誤」消失。

其實我又增加了罐子到構建路徑,但由於某些原因,他們無法與錯誤

Archive for required library in project cannot be read or is not a valid ZIP file

所以不是我說他們是「外部JAR」讀取。這有助於解決所有編譯問題!

2

你會看到這種錯誤情況下,在你的庫文件的一些類,你在classpath中必須有參考不存在的CLASSE(S)這可能是在另一個JAR文件。在這裏,當我沒有添加org.springframework.beans-3.1.2.RELEASE.jar並且從我的類路徑的org.springframework.jdbc-3.1.2.RELEASE.jar中擴展了一個類org.springframework.jdbc.core.support.JdbcDaoSupport時,我收到了這個錯誤。

6

有時,當你添加一個罐子,你所需要的,但不包括它需要的罐子它發生。在我的情況下,添加tomcat/lib中的所有jar幫助我解決了這個問題。我正在開發一個網絡應用程序。

2

問題可能是您包含不正確的罐子。我遇到了同樣的問題,原因是我在項目的構建路徑中包含了不正確的默認JRE庫。我用另一個版本安裝了Java,並且包含了Java版本的JRE文件。 (我在我的系統中安裝了JRE 1.6,並且由於之前安裝了Java,所以在構建路徑中包含了JRE庫1.7)。也許您可以檢查包含在構建路徑中的JRE庫是否是正確的版本。您已在系統中安裝的Java版本。

2

我已經經歷了基於Eclipse朱諾這個問題,根本原因是,雖然被包括在由瞬時Maven依賴一些春天罐子,他們被列入不正確的版本。在同一個版本:

所以,你應該如果使用的是模塊化的框架如春,每一個模塊(內核,豆類,背景,AOP,TX等,或至少是最重要的)檢查。

爲了解決我以前用過行家dependnecy排除,以避免瞬時依賴的版本不正確的問題。

3

我在將JDK升級到新版本後出現此問題。我不得不更新對Project Properties/Java Build Path中庫的引用。

3

我還有一個案例。給出正確的項目路徑,並將其導入到eclipse中。

然後進入項目 - >清潔 - >清理所有項目。

0

對我來說是改變與谷歌的API

1

對我來說,Android的API級別爲一,這個問題是由於錯誤的進口。實際上,添加v7支持庫後需要更新導入。

可以固定做如下,爲每個類項目的:

    1. 刪除所有的線用import android.[*],每個班重新組織你的導入:從上下文菜單中選擇源/組織導入或(CTRL + SHIFT + O)
    2. 當系統提示時,選擇庫android.support.[*](而不是android.[*])。
  • 0

    我太有這個問題......我發現的類這是引發此異常層次結構,不能所有的方式回到它的根類的日食全程追溯...我解釋:

    在我的情況下,我有3個java項目:A,B和C ...其中A和B是maven項目,C是常規的java eclipse項目...

    在項目A中, 「interfaceA」... 在項目B中,我有接口「interfaceB」,它擴展了「interfaceA」 在項目C中,我有具體的類「classC」,它實現了「interfa ceB「

    」項目C「在其構建路徑中包含」項目B「,但不包含」項目A「(因此導致了錯誤)....將」項目A「包含在建立「C」的路徑,一切都恢復正常...

    0

    這絕對是因爲缺少的依賴不在我的maven pom.xml中。

    例如,我想爲我的broadleaf電子商務演示網站的實現創建集成測試。

    爲了重新使用配置文件和基本測試類,我已經在broadleaf commerce中包含了一個broadleaf jar集成測試。該項目有其他測試依賴項,我沒有包括在內,我收到了「不一致的層次結構」錯誤。

    從broadleaf/pom.xml和爲broadleaf/pom.xml中的每個依賴關係提供版本的關聯屬性變量複製「測試依賴關係」之後,錯誤消失了。

    性質是:

    <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> 
    

    的依賴是:

    <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> 
    
    0

    我有與OSGi的一個項目擴展LabelProvider一類中,有錯誤發生。解決方案是:將org.eclipse.jface添加到清單中所需的插件。mf而不是像org.eclipse.jface.viewers那樣導入單個軟件包

    1

    如果擴展類存在問題,則會顯示上述錯誤消息。

    class Example extends Example1 { 
    
    } 
    

    解決問題Example1

    4

    你應該清理項目,或重新啓動Eclipse。

    0

    我有相同的確切問題標記,並通過從實際上是第一個實現(「超級」是抽象方法)的方法中刪除@Override註釋來解決它,而不是覆蓋。

    1

    就我而言,許​​多類中的導入引用包含一個額外的單詞。我通過編輯所有文件來獲得正確的導入來解決它。我開始手動進行編輯。但是當我看到這個模式時,我在eclipse中使用find..replace來自動化它。這解決了錯誤。

    0

    如果您要導入eclipse項目只需 1.轉到項目屬性下的java構建路徑設置。 2.如果JRE系統庫附有錯誤標誌,請雙擊它打開編輯庫窗口 3.將執行環境更改爲正確的java版本系統或選擇通過檢查無線電編輯其他設置按鈕分配給他們。 4.單擊完成

    0

    錯誤:「類名稱」類型的層次結構是不一致的錯誤。

    溶液: 類OtherDepJar {} - >是內部「other.dep.jar」

    DepJar延伸OtherDepJar {} - >是內部「dep.jar」

    class ProblematicClass extends DepJar {} - >在當前項目中。

    如果dep.jar是在項目的類路徑,但other.dep.jar是不是在項目的類路徑,Eclipse會顯示「類型的層次結構...不一致錯誤」

    0

    當在Eclipse中導入GWT項目而不安裝「Google Plugin for Eclipse」,會發生這種情況。安裝「Google Plugin for Eclipse」後,此錯誤將消失。

    相關問題