2013-10-01 25 views
2

對於vSphere Web Client插件,我創建了一個java服務,我嘗試使用VI JAVA在ESX主機中創建一個數據存儲。我包含在服務實現在處女座部署VI JAVA拋出java.lang.NoClassDefFoundError

import com.vmware.vim25.*; 
import com.vmware.vim25.mo.*; 

文件,其中包括外部罐子STS環境並創建了一個功能列出所有主機:

public List<String> listVcHosts() throws Exception{ 
    ManagedEntity[] hosts = new InventoryNavigator(rootFolder).searchManagedEntities("HostSystem"); 
    List<String> listHosts = new ArrayList<String>(); 
    for(ManagedEntity me : hosts) { 
     HostSystem host = (HostSystem) me; 
     //Adding the list of hosts in List 
     listHosts.add(host.getName().toString()); 
    } 
    return listHosts; 
} 

當我執行從STS的Java應用程序的工作正常,沒有任何警告。

我將JARS複製到服務器/代答文件夾,並嘗試在VIRGO中部署服務。

它拋出以下異常:

An Import-Package could not be resolved. Caused by missing constraint in bundle <com.xx.xxx.xxxx_1.0.0> 
      constraint: <Import-Package: com.vmware.vim25.mo; version="0.0.0"> 

回答

1

看來你忘了,包括您的MANIFEST.MF文件的包com.vmware.vim25.mo。 檢查這個文件,MANIFEST.MF應該有一行導入這個包。

相關問題