Virgo Server Throwing java.lang.NoClassDefFoundError: org/json/JSONException Error while deploying a Java package

StackOverflow https://stackoverflow.com/questions/18918311

Question

While creating a vSphere web client plugin am calling a REST server from Java and parse the JSON Array using the Jackson Library

In the Java Service project build-java.ant file i added

<classpath>
            <!-- remove this if you are not using the SDK on the java side -->
            <pathelement path="${VSPHERE_SDK_HOME}/libs/vsphere-client-lib.jar"/>
            <pathelement path="C:\Users\vignesh\Desktop\plugins\jackson-annotations-2.2.0.jar"/>
            <pathelement path="C:\Users\vignesh\Desktop\plugins\jackson-core-2.2.0.jar"/>
            <pathelement path="C:\Users\vignesh\Desktop\plugins\jackson-databind-2.2.0.jar"/>

I tried to build the package and it is working file .. builded successfully

After that i tried to deploy that in virgo server In the vsphere web server pickup directory i added three jar files of Jackson i tried to redeploy the project , that time it is throwing

[2013-09-20 18:35:43.154] [ERROR] region-dm-3                   <AG0000E> Application context creation failure for bundle 'com.acme.xxx.xxxx' version '1.0.0'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxx' defined in URL [bundleentry://274.fwk22736215/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/json/JSONException
    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$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)

and i imported only

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;

and only throwing IOException

Was it helpful?

Solution

Check the VIRGO STS Compatibility of your package

Jackson JSON mapper and parser supports version 0.9.9.4 to 1.4.3

For more info Check http://ebr.springsource.com/repository/app/bundle?query=J

OTHER TIPS

Add the imported external jars in META-INF -> MANIFEST.MF in your resources

Import-Package: com.fasterxml.jackson;version="1.4.3"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top