VMware {code} Community
dongtong
Contributor
Contributor

vsphere-wssdk-provider sample code reports error when starts server

Hi,

When I run the vsphere-wssdk-provider sample code, it reports the following errors:

--------------------------------------------------------------------------------------------------------------------->

Application context creation failure for bundle 'com.sample.evwcpservice.EvwcpService' version '1.0.0'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EchoService': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EchoServiceImpl' defined in URL [bundleentry://139.fwk30018216/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sample.evwcpservice.EchoServiceImpl]: Constructor threw exception; nested exception is com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.vmware.vim25.VimPortType

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)

    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)

    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)

    at org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:722)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EchoServiceImpl' defined in URL [bundleentry://139.fwk30018216/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sample.evwcpservice.EchoServiceImpl]: Constructor threw exception; nested exception is com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.vmware.vim25.VimPortType

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

    at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:167)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

    ... 17 common frames omitted

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sample.evwcpservice.EchoServiceImpl]: Constructor threw exception; nested exception is com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.vmware.vim25.VimPortType

    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)

    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

    ... 27 common frames omitted

Caused by: com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.vmware.vim25.VimPortType

    at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:192)

    at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:652)

    at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:640)

    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:332)

    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:315)

    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:297)

    at javax.xml.ws.Service.getPort(Service.java:119)

    at com.vmware.vim25.VimService.getVimPort(VimService.java:56)

    at com.sample.evwcpservice.EchoServiceImpl.init(EchoServiceImpl.java:46)

    at com.sample.evwcpservice.EchoServiceImpl.<init>(EchoServiceImpl.java:40)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.lang.reflect.C

...

----------------------------------------------------------------------------------------------------------------------------------------->

I checked the codes which reports error,

------------------------------------------------------------------------------------------------------------------------------------------>

/** object for access to all of the methods defined in the vSphere API */

   private static VimPortType _vimPort = initializeVimPort();

   private static VimPortType initializeVimPort() {

      // Static initialization is preferred because it takes a few seconds.

      VimService vimService = new VimService();

      return vimService.getVimPort();

   }

----------------------------------------------------------------------------------------------------------------------------------------->

I have investigated this issue, and someone said that jdk version invokes that error.

That guy used jdk 1.6.22 and it worked. I'm sure whether it was right. Could someone help me figure out this issue.

Thanks a  lot

0 Kudos
6 Replies
laurentsd
VMware Employee
VMware Employee

You forgot to mention your Java JDK version and your Web Client SDK version. Thanks.

0 Kudos
dongtong
Contributor
Contributor

Hi Laurentsd:

I changed JDK version to 1.6.22 and vsphere web client 5.1, but java service class still reports "INFO:A WebService annotation is not present on class: com.vmware.vim25.VimPortType" in production environment, and then

I wrote a single java test class, and import vim25.jar, the error never happened again. I guest that production environment does not import vim25.jar, and then I added vim25.jar path to system path, the error still happened.

----------------------------------snippet code------------------------------------------------------------------------------->

jVimService vimService = new VimService();

VimPortType vimPort = vimService.getVimPort();

------------------------------------------------------------------------------------------------------------------>

I do not know what's the matter with it. I will be appreciated if you could help me.

Thanks

0 Kudos
shankarvn
Contributor
Contributor

Hi dongtong,

Where did you get your vim25.jar from? I ran into this a while back and I am trying to recollect how I fixed it - Please paste the contents of the MANIFEST file as well from the vim25.jar. Something was wrong about the vim25.jar from the samples because of which I had to get it again from the management SDK, fix its manifest file, re-jar it and put it back in wherever all the third party JAR's are expected to be put.

Regards.

0 Kudos
dongtong
Contributor
Contributor

Hi

0 Kudos
shankarvn
Contributor
Contributor

Hi dongtong,

(Apologies for the delay)

I have the vim25.jar for web client 5.5. The error is telling us that there is an issue with the annotation and it is from the osgi runtime (it is trying to enforce something up front that I cannot understand very well). I would suggest the following - Login to the vmware site and download the Management SDK - You will find a vim25.jar in there (that is different from what ships with the samples and has classes that are missing in the samples). The manifest looks like this for us

///////////////////////////////////////////////////////////////////////

Manifest-Version: 1.0

Export-Package: com.vmware.vim25;uses:="javax.jws,javax.xml.bind,javax

.xml.bind.annotation,javax.xml.datatype,javax.xml.namespace,javax.xml

.ws"

Bundle-Vendor: VMware

Bundle-Version: 1.0.0

Tool: Bundlor 1.0.0.RELEASE

Bundle-Name: ws-vim25

Bundle-ManifestVersion: 2

Created-By: 1.6.0_22 (Sun Microsystems Inc.)

Bundle-SymbolicName: com.vmware.wsvim25

Import-Package: javax.jws,javax.xml.bind,javax.xml.bind.annotation,jav

ax.xml.datatype,javax.xml.namespace,javax.xml.ws

///////////////////////////////////////////////////////////////////////

I think the text above in bold is what is most important for this error to go away. Make sure the manifest file is changed and you have it showing up correctly in the vim25.jar that you recreate. Also make sure you copy the new jar into the right locations if you are using a local Virgo server for plugin development(serenity-client\server\repository\usr\vim25.jar and serenity-client\server\pickup\vim25.jar)

I was stuck on this for a very long time until I got the SDK from here and fixed the manifest as well (you will need to login to get this) - https://my.vmware.com/group/vmware/details?downloadGroup=VSP510-WEBSDK-510&productId=285

Thanks

0 Kudos
atchutmca
Contributor
Contributor

Hi shankarvn,

I'm also facing the same issue. And I even tried the steps as changing the Manifest file as you have mentioned. But it didn't work and still getting the same error. My exception stack trace is as follows.

com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.vmware.vim25.VimPortType

  at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(Unknown Source)

  at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(Unknown Source)

  at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(Unknown Source)

  at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)

  at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)

  at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)

  at javax.xml.ws.Service.getPort(Unknown Source)

  at com.vmware.vim25.VimService.getVimPort(VimService.java:56)

  at com.test.VSphere.setSelectedVM(VSphere.java:126)

  at com.test.VSphere.main(VSphere.java:57)

Could you please help me out with this?

Thanks & Regards,

Atchut.

0 Kudos