Topic
No replies
SystemAdmin
SystemAdmin
9224 Posts
ACCEPTED ANSWER

Pinned topic how to invoke code installed in an OSGI framework from sMash event handler

‏2011-08-08T18:13:32Z |
Currently we have a java application that is called from CLI and invoke OSGI services. When we perform test of the application on eclipse, we launch it as an eclipse application where we can define all the arguments, plugins, configurations.
Now, we want to be able to invoke this application via REST API as well. I have installed the sMash plugin on eclipse and configure it with an event handler (miupdate). I was able to received the calls but when I try to invoke any class that make calls to any of the plugins, I am getting class loader problem.

java.lang.NoClassDefFoundError: com.ibm.isas.rest.command.impl.RestAPI
at com.ibm.isas.smash.OsgiAdapter.executeRequest(OsgiAdapter.java:30)
at com.ibm.isas.smash.miupdate.handleRequest(miupdate.java:97)
at com.ibm.isas.smash.miupdate.onPOST(miupdate.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at zero.core.interpreter.JavaInterpreter.invoke(JavaInterpreter.java:64)
at zero.core.events.dispatcher.EventDispatcher.invoke(EventDispatcher.java:73)
at zero.core.events.dispatcher.OneDispatcher.invoke(OneDispatcher.java:43)
at zero.core.events.EventEngine.dispatch(EventEngine.java:305)
at zero.core.events.EventEngine.fire(EventEngine.java:135)
at zero.core.handlers.DefaultRequestHandler.invoke(DefaultRequestHandler.java:148)
at zero.core.handlers.DefaultRequestHandler.onRequest(DefaultRequestHandler.java:56)
at zero.core.cfadapter.ChannelFrameworkAdapter.fireEvents(ChannelFrameworkAdapter.java:696)
at zero.core.cfadapter.ChannelFrameworkAdapter.service(ChannelFrameworkAdapter.java:315)
at zero.core.cfadapter.ZeroLink.doWork(ZeroLink.java:63)
at zero.core.cfadapter.ZeroLink.ready(ZeroLink.java:50)
at zero.network.internal.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:460)
at zero.network.internal.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:389)
at zero.network.internal.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
at zero.network.internal.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:215)
at zero.network.internal.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:114)
at zero.network.internal.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:558)
at zero.network.internal.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:608)
at zero.network.internal.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:985)
at zero.network.internal.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1070)
at zero.network.vendor.runtime.ThreadPoolRepositoryManager$DefaultThreadPool$Worker.run(ThreadPoolRepositoryManager.java:719)
Caused by: java.lang.ClassNotFoundException: com.ibm.isas.rest.command.impl.RestAPI
at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:77)
at java.net.URLClassLoader.findClass(URLClassLoader.java:383)
at java.lang.ClassLoader.loadClass(ClassLoader.java:652)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:346)
at java.lang.ClassLoader.loadClass(ClassLoader.java:618)

I am told that sMash need to be installed or provided as an OSGi bundle in order for them to easily interact with the rest of the system which is installed in an OSGi Framework.
Have anyone done something similar before? Any idea what I need to do?