REST Service calling REST service = failure deployment on karaf

One Star

REST Service calling REST service = failure deployment on karaf

Hi everybody,
I'm facing an issue on Karaf when i'm trying to deploy a REST service that calling another REST service.
11:54:59,209 | ERROR | container/deploy | container.BlueprintContainerImpl  437 | 13 - org.apache.aries.blueprint.core - 1.6.1 | Unable to start blueprint container for bundle sandbox.rest_SWAGGER_wadlToSwagger_001/0.1.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:728)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher$2.call(EquinoxEventPublisher.java:189)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1280)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1263)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.notifyEventHooksPrivileged(EquinoxEventPublisher.java:186)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:146)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:466)
at org.eclipse.osgi.container.Module.start(Module.java:457)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/InternalServerErrorException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructors(Unknown Source)
at org.apache.aries.blueprint.container.BeanRecipe.findMatchingConstructors(BeanRecipe.java:533)
at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:345)
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:90)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:955)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:929)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:910)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:844)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)
... 27 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.InternalServerErrorException cannot be found by sandbox.rest_SWAGGER_wadlToSwagger_001_0.1.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 53 more

Does anyone encounter the same issue ?
Is there a way to make it work ?
I'm using 6.2 open studio.
Thanks for your help.
Moderator

Re: REST Service calling REST service = failure deployment on karaf

Hi,
Can you run your esb job successfully in studio? What does your ESB job design look like? More information will be helpful for us to address your issue.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: REST Service calling REST service = failure deployment on karaf

Hi,
Yes, in the studio, everything work fine.
You'll find screenshot attach to this message  
 
It's a REST Web Service.
I'm calling a web page (wadl), retrieve the data and call another REST Service with a tRest component.
Thanks for your help.
Employee

Re: REST Service calling REST service = failure deployment on karaf

Hi,
Looks like the class loader problem of duplicated JAX-RS api, could you please try this workaround?
1) check the exported kar file from Studio to see if there is jersey-core-xx.jar or other jar may have JAX-RS api included, if you find it then remove it from the kar file.
2) modify the Manifest of the bundle in the kar file, add package javax.ws.rs.* to the Import-Package section.
Regards.
One Star

Re: REST Service calling REST service = failure deployment on karaf

Thanks for this answer !
Now the bundle is deployed but, there is no service display in the :8040/services of CXF 
(The bundle is active)
One Star

Re: REST Service calling REST service = failure deployment on karaf

ERRATUM,
After some modifications, i have an error at the deployment on the MANIFEST (even if the manifest exist or is good) 
15:18:09,851 | ERROR | container/deploy | ?                                   ? | 8 - org.apache.felix.fileinstall - 3.5.4 | Failed to install artifact: C:\Users\kdu\Documents\TOS 6.2.1\Runtime_ESBSE\container\deploy\rest_SWAGGER_wadlToSwagger_001-0.1.jar
org.osgi.framework.BundleException: The bundle file:/C:/Users/kdu/Documents/TOS%206.2.1/Runtime_ESBSE/container/deploy/rest_SWAGGER_wadlToSwagger_001-0.1.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1004)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:952)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:871)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)

Thanks for your help.
Employee

Re: REST Service calling REST service = failure deployment on karaf

Maybe the zip tool problem you're using, (7-Zip?), I was testing it before with WinRAR tool on Windows platform and it works without this kind of problem.
One Star

Re: REST Service calling REST service = failure deployment on karaf

What i've done :

added javax.ws.rs-1.0.jar to /lib
added javax.ws.rs-api-2.0.1.jar to /lib
deleted jersey.core.* in /lib
modified MANIFEST (added javax.ws.rs.* to the Imported Package and added the Bundle-ClassPath for these two new jar)

Now, i have error about jersey class not found (i deleted it....)
10:09:18,837 | ERROR | container/deploy | container.BlueprintContainerImpl  437 | 13 - org.apache.aries.blueprint.core - 1.6.1 | Unable to start blueprint container for bundle sandbox.rest_SWAGGER_wadlToSwagger_001/0.1.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:728)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher$2.call(EquinoxEventPublisher.java:189)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1280)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1263)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.notifyEventHooksPrivileged(EquinoxEventPublisher.java:186)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:146)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:466)
at org.eclipse.osgi.container.Module.start(Module.java:457)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/core/util/FeaturesAndProperties
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:272)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:632)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:588)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:540)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:527)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:320)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructors(Class.java:1651)
at org.apache.aries.blueprint.container.BeanRecipe.findMatchingConstructors(BeanRecipe.java:533)
at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:345)
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:285)
at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:252)
at org.apache.aries.blueprint.container.ServiceRecipe.internalCreate(ServiceRecipe.java:149)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)
... 27 more
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.core.util.FeaturesAndProperties cannot be found by sandbox.rest_SWAGGER_wadlToSwagger_001_0.1.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 63 more
10:09:18,847 | INFO | container/deploy | ? ? | 8 - org.apache.felix.fileinstall - 3.5.4 | Started bundle: file:/C:/Users/kdu/Documents/TOS%206.2.1/Runtime_ESBSE/container/deploy/rest_SWAGGER_wadlToSwagger_001-0.1.jar
Employee

Re: REST Service calling REST service = failure deployment on karaf

Hmm, in this case maybe try to only remove javax/ws/rs package/classes from jersey.core.*, and keep jersey.core.* there in the lib/.
And you should not add the javax.ws.rs-1.0.jar/javax.ws.rs-api-2.0.1.jar into the lib/, just add javax.ws.rs.* to the Importe-Package of Manifest, that's enough because in this case the JAX-RS api classes will be loaded from Runtime karaf container.
(this is not a good workaround, but just try to see if it works)
One Star

Re: REST Service calling REST service = failure deployment on karaf

We're going back to the first error with this :/
One Star

Re: REST Service calling REST service = failure deployment on karaf

Any new idea, or fix found on your side ?
Not applicable

Re: REST Service calling REST service = failure deployment on karaf

I ran into this exact same issue today.  Trying to deploy a service to runtime and got this error.  I have a mix of tRestRequest/tRestResponse/tRestClient/tRest components all being used in my service.  I needed to use tRest because the service we are interfacing with on that component would not work with tRestClient (the JSON payload was incorrectly formatted).  I was able to get things working fine in my Studio environment using the tRest component, but once deployed to the Runtime environment, I encountered the same error reported in this thread.
So, to work around this issue, I replaced the usage of tRest with tHTTP.  Fortunately, tHTTP works fine with the API we are interfacing with.  And, this version of the service can now be successfully deployed to the Runtime environment.  So, the issue is specifically with the tRest component.  Not sure if it's a combination of using tRest with other tRestClient components in the same job, or specific to tRest by itself.  We've never had to use tRest before, as tRestClient has always worked for us.  But, the JSON formatting issue caused us to not use tRestClient for this one API in this instance.
Seven Stars

Re: REST Service calling REST service = failure deployment on karaf

Just curious, has anyone raised a JiraIssue for this?
One Star

Re: REST Service calling REST service = failure deployment on karaf

Hi,
I get the same issue. I opened a ticket on Talend Support.I will keep you informed.
Eric
One Star

Re: REST Service calling REST service = failure deployment on karaf

Hi,
There is JIRA https://jira.talendforge.org/browse/TESB-14782 about this issue.
Eric