2009-11-14 26 views
1

我跑mvn jetty:run-war時,遇到下列錯誤:碼頭 - 的NoSuchMethodError

2009-11-14 15:19:28.459:/:INFO: Initializing Spring root WebApplicationContext 
* ERROR 15:19:28,491 Context initialization failed (ContextLoader.java [main]) 
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V 
... 

(不包括整個堆棧跟蹤)

我知道,有什麼不對的代碼,因爲它無論是在工作完全正常Windows和OSX。現在我使用Ubuntu karmic koala並通過apt-get安裝maven,是否可能有一些我忘記在linux中配置以使其工作?在執行mvn clean install時,我沒有收到任何錯誤。

有人嗎?

+0

也許你沒有使用相同版本的Spring框架。 – Geo 2009-11-14 17:45:41

+0

但是,如何在我的pom.xml文件中指定此依賴關係時如何獲得兩個不同版本的Spring框架?我的意思是......它適用於所有其他平臺。 – Pap 2009-11-14 17:52:28

回答

0

某處存在兼容性不匹配。也許你的本地倉庫包含一些jar的「陳舊」版本。我建議重新嘗試一個新鮮和乾淨的本地存儲庫。

首先,製作備份副本:

mv ~/.m2/repository ~/.m2/repository.save 

然後,再次嘗試。

0

我認爲問題是與本地存儲庫。 我猜你的Maven的回購協議會像儲存根/ .m2目錄/庫 舊罐子可能是問題

我想你已經寫碼頭depandencies像下面

<plugin> 
      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>${jetty.version}</version> 
      <configuration> 
       <webAppSourceDirectory>WebContent</webAppSourceDirectory> 
       <!-- <classesDirectory>WebContent/WEB-INF/classes</classesDirectory> --> 
       <!-- Redeploy every 1 seconds if changes are detected, 0 for no automatic 
        redeployment --> 
       <scanIntervalSeconds>0</scanIntervalSeconds> 
       <!-- reload manually by hitting enter on console --> 
       <reload>manual</reload> 
       <webApp> 
        <contextPath>/</contextPath> 
        <descriptor>WebContent/WEB-INF/web.xml</descriptor> 
       </webApp> 
       <connectors> 
        <connector implementation="org.eclipse.jetty.server.bio.SocketConnector"> 
         <port>8080</port> 
         <maxIdleTime>600000</maxIdleTime> 
        </connector> 
       </connectors> 
      </configuration> 
     </plugin> 

檢查是否在「MVN安裝「是一個成功,然後運行碼頭。