2

对于 vSphere Web Client 插件,我创建了一个 java Service ,我尝试使用 VI JAVA 在 ESX 主机中创建一个数据存储。包括我

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

服务实现中的文件,并将外部 JARS 包含到 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 复制到 server/pickup 文件夹并尝试在 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">  
4

1 回答 1

1

It seems you forget to include the package com.vmware.vim25.mo in your MANIFEST.MF file. Check this file, the MANIFEST.MF should have a line importing this package.

于 2014-04-06T19:51:39.067 回答