Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

Which is the best way to include third party jars into a vSphere Web Client plugin?

$
0
0

Hello,

 

I created a plugin for vSphere Web Client which is using some third party jars. For this, I defined them as bundles in plugin-package.xml and also added the packages in Import-Package section of the service plugin's manifest file.

The bundles are loaded, I can see that in the log file in virgo server, each of them is installed, resolved and started. The same for service jar and ui war bundles.

When I open the web client in the browser, I can see the ui of my plugin, but when executing an operation which makes a call to the service plugin I get ClassNotFoundException for a class from one of the third party jars which is not called from my code but from another class from the same jar.

 

[2012-09-19 13:30:58.390] ERROR [ERROR] http-bio-9443-exec-3          o.apache.wink.common.internal.application.ApplicationFileLoader   The runtime environment failed to instantiate the org.apache.wink.common.internal.providers.entity.csv.CsvSerializerProvider class. Ensure that the class is not abstract, has a valid constructor, has the right visibility, and is not an inner member class. java.lang.NoClassDefFoundError: Could not initialize class org.apache.wink.common.internal.providers.entity.csv.CsvSerializerProvider
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.wink.common.internal.utils.ClassUtils$1.run(ClassUtils.java:80)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.wink.common.internal.utils.ClassUtils.loadClass(ClassUtils.java:66)
at org.apache.wink.common.internal.application.ApplicationFileLoader.loadClasses(ApplicationFileLoader.java:131)
at org.apache.wink.common.internal.application.ApplicationFileLoader.<init>(ApplicationFileLoader.java:97)
at org.apache.wink.common.internal.application.ApplicationFileLoader.<init>(ApplicationFileLoader.java:66)
at org.apache.wink.client.ClientConfig$1.run(ClientConfig.java:112)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.wink.client.ClientConfig.initDefaultApplication(ClientConfig.java:109)
at org.apache.wink.client.ClientConfig.clone(ClientConfig.java:408)
at org.apache.wink.client.RestClient.<init>(RestClient.java:81)

 

I can also see that classes which my code uses directly are loaded successfully. Like org.apache.wink.client.ClientConfig.

Including org.apache.wink.common.internal.providers.entity.csv package in the manifest file doesn't help.

 

This is the manifest file:

 

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: test-service
Bundle-SymbolicName: com.vmware.Testservice

Bundle-Version: 1.0.0
Bundle-Vendor: test
Import-Package: org.apache.commons.logging,
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.lang,
javax.xml.bind,
javax.activation,
javax.xml.stream,
javax.ws.rs,
javax.ws.rs.core,
org.apache.wink.client,
org.apache.wink.client.handlers,
javax.net.ssl
Export-Package: com.wmware.testservice

 

And the plugin-package.xml file

 

<?xml version="1.0" encoding="UTF-8"?>

<pluginPackage id="com.vmware.test-service" version="1.0.0" name="test-service"
      description="Desc" vendor="test">
   <dependencies>
      <pluginPackage id="com.vmware.vsphere.client" version="5.1.0" />
   </dependencies>
   <bundlesOrder>
   <bundle id="org.apache.commons.codec" />
   <bundle id="org.apache.commons.lang" />
   <bundle id="javax.xml.bind" />
   <bundle id="javax.activation" />
   <bundle id="javax.xml.stream" />
   <bundle id="javax.ws.rs.jsr311-api" />
   <bundle id="org.apache.wink.common" />

   <bundle id="org.apache.wink.client" />
   <bundle id="com.vmware.Testservice" />
   <bundle id="com.vmware.Testui" />
   </bundlesOrder>
</pluginPackage>

 

I have the web client installed locally connecting to a remote vCenter server.

 

My question is, is this the right way to include third party jars? And then if someone has encountered this problem or knows how to solve it, please help me.

 

Thanks!


Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>