简体   繁体   中英

Deploying VI JAVA in Virgo throwing java.lang.NoClassDefFoundError

For vSphere Web Client plugin, I created a java Service , I try to create a datastore in the ESX host using VI JAVA. I included

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

files in service implementation and included external JARS to STS environment and created a function to list all hosts:

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

When I am executing as JAVA Application from STS its working fine without any warnings.

I copied JARS to server/pickup folder and tried to deploy the services in VIRGO.

It's throwing the following exception:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM