2013-11-14 80 views
0

當我用下面的蔚藍中創建一個表(JAVA)的Windows Azure Java SDK的0.4.6,CloudTableClient失蹤GetTableReference功能

CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); 
CloudTableClient tableClient = storageAccount.createCloudTableClient(); 
CloudTable table = tableClient.getTableReference("people"); 
table.createIfNotExist(); 

我收到以下異常:

java.lang.NoSuchMethodError: com.microsoft.windowsazure.services.table.client.CloudTableClient.getTableReference(Ljava/lang/String;)Lcom/microsoft/windowsazure/services/table/client/CloudTable;

我使用下面的lib:microsoft-windowsazure-api-0.4.6.jar。 對桌子的所有其他調用完美地工作。

當我使用microsoft-windowsazure-api-0.2.2.jar時,我必須使用createTableIfNotExists方法,這對我來說非常合適。但是想更新lib以獲得更好的故障處理。

有沒有人遇到同樣的問題?任何幫助表示讚賞!

回答

0

我只是想用下面的代碼,它爲我工作得很好:

package TestPackage; 
import java.net.URISyntaxException; 
import java.security.InvalidKeyException; 
import com.microsoft.windowsazure.services.core.storage.*; 
import com.microsoft.windowsazure.services.table.client.*; 

public class TestClass { 
    public static void main(String[] args) throws URISyntaxException, StorageException, InvalidKeyException { 
     CloudStorageAccount storageAccount = 
       CloudStorageAccount.parse("UseDevelopmentStorage=true"); 

      // Create the table client. 
      CloudTableClient tableClient = storageAccount.createCloudTableClient(); 

      // Create the table if it doesn't exist. 
      String tableName = "people"; 
      CloudTable table = tableClient.getTableReference(tableName); 
      table.createIfNotExist(); 
      //tableClient.createTableIfNotExists(tableName); 

      System.console().readLine(); 
    } 

} 

和下面的截圖顯示了所有庫我引用

enter image description here

+0

感謝提示。這幫助我解決了這個問題。 –

0

,它的作品在技巧後小程序,我開始一步一步地將我的代碼和libs從一個沒有工作的項目複製到一個小工程中。

我注意到,當我將al libs複製到新項目時,它停止工作。然後我看到我的lib目錄中還有舊的Azure 0.2.2 lib。這個不在構建路徑中,所以它編譯得很完美,並且除了創建一個新表之外,其他地方都可以工作

當我刪除我舊的天藍色的圖書館一切工作就像一個魅力。

感謝您的幫助。