Hi Mike, Hi Raymond, I tried the solution you suggested. Another error occurred... I filed that issue to https://issues.apache.org/jira/browse/TUSCANY-3595.
greetings, Alex Am 15.06.10 23:28 schrieb "Mike Edwards" unter <[email protected]>: > Alex, > > You're running the code under OSGi? > > To me, this looks like the binding-rest-runtime module has not been tested > running under OSGi. It > is clearly missing one MAINFEST.MF entry, which causes the ClassNotFound > exception you're getting. > I am concerned that there may be more similar failures due to the lack of > testing under OSGi. > > To fix the particular problem you have here, the following needs to be added > to the Import-Package: > section of the MANIFEST.MF for the binding-rest-runtime module: > > org.apache.tuscany.sca.interfacedef.java;version=2.0.0, > > However, just adding this may well not be enough. > > I am not familiar with the binding-rest-runtime module, so it will take me > some time to get to grips > with it and make it work properly under OSGi - hopefully someone else from the > Tuscany team can take > a look at it more quickly. > > > Yours, Mike. > > > Alexander Blotny wrote: >> Hi, >> >> I have a problem to export a REST service via an OSGi bundle. Most of >> the code is taken from the store example for binding.rest. >> (http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html) >> >> I got following exception: >> >> java.lang.IllegalStateException: java.lang.NoClassDefFoundError: >> org/apache/tuscany/sca/interfacedef/java/JavaInterface >> at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:173) >> at >> org.apache.tuscany.sca.node.osgi.impl.NodeManager.bundleStarted(NodeManager.j >> ava:117) >> at >> org.apache.tuscany.sca.node.osgi.impl.NodeManager.bundleChanged(NodeManager.j >> ava:139) >> at >> org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(Bund >> leContextImpl.java:916) >> at >> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.j >> ava:220) >> at >> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(Li >> stenerQueue.java:149) >> at >> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileg >> ed(Framework.java:1350) >> at >> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framewo >> rk.java:1301) >> at >> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.ja >> va:362) >> at >> org.eclipse.osgi.framework.internal.core.AbstractBundle.updateWorker(Abstract >> Bundle.java:625) >> at >> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundle >> .java:572) >> at >> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundle >> .java:555) >> at >> org.apache.felix.shell.impl.UpdateCommandImpl.execute(UpdateCommandImpl.java: >> 96) >> at >> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activat >> or.java:286) >> at >> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184) >> at java.lang.Thread.run(Thread.java:637) >> Caused by: java.lang.NoClassDefFoundError: >> org/apache/tuscany/sca/interfacedef/java/JavaInterface >> at >> org.apache.tuscany.sca.binding.rest.provider.RESTServiceBindingProvider.regis >> terWithJAXRS(RESTServiceBindingProvider.java:217) >> at >> org.apache.tuscany.sca.binding.rest.provider.RESTServiceBindingProvider.start >> (RESTServiceBindingProvider.java:143) >> at >> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl$1.run(Compos >> iteActivatorImpl.java:423) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.startEndpoin >> t(CompositeActivatorImpl.java:421) >> at >> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compos >> iteActivatorImpl.java:377) >> at >> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compos >> iteActivatorImpl.java:309) >> at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:147) >> ... 15 more >> >> >> The bundle has the following structure: >> >> META-INF MANIFEST.MF META-INF/maven META-INF/maven <no contents> >> META-INF/maven/de.fhg.fokus.ngni.xposer.see.samples >> META-INF/maven/de.fhg.fokus.ngni.xposer.see.samples <no contents> >> META-INF/maven/de.fhg.fokus.ngni.xposer.see.samples/helloworld-exporter >> pom.properties pom.xml OSGI-INF OSGI-INF <no contents> OSGI-INF/sca >> bundle.componentType bundle.composite de de <no contents> de/fhg >> de/fhg <no contents> de/fhg/fokus de/fhg/fokus <no contents> >> de/fhg/fokus/ngni de/fhg/fokus/ngni <no contents> >> de/fhg/fokus/ngni/xposer de/fhg/fokus/ngni/xposer <no contents> >> de/fhg/fokus/ngni/xposer/see de/fhg/fokus/ngni/xposer/see <no contents> >> de/fhg/fokus/ngni/xposer/see/samples >> de/fhg/fokus/ngni/xposer/see/samples <no contents> >> de/fhg/fokus/ngni/xposer/see/samples/helloworld Activator.class >> HelloREST.class de/fhg/fokus/ngni/xposer/see/samples/helloworld/impl >> HelloRESTImpl.class >> >> bundle.composite: >> >> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" >> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> targetNamespace="http://calculator.dosgi" name="HelloworldComposite"> >> <component name="HelloworldComponent"> >> <tuscany:implementation.osgi >> bundleSymbolicName="helloworld-exporter" bundleVersion="0.0.1" /> >> <service name="HelloworldServiceREST"> >> <tuscany:binding.rest uri="http://localhost:8087/Helloworld"/ >> <http://localhost:8087/Helloworld"/>> </service> >> </component> >> >> >> bundle.componentType: >> >> <componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"> >> >> <service name="HelloworldServiceREST"> <interface.java >> interface="de.fhg.fokus.ngni.xposer.see.samples.helloworld.HelloREST"/> >> </service> >> </componentType> >> >> HelloREST.java: >> >> @Remotable public interface HelloREST { @GET String getAll(); >> @GET @Path("{id}") String getItemById(@PathParam("id") >> String itemId); @POST void addItem(Item item); @PUT >> void updateItem(Item item); @DELETE @Path("{id}") void >> deleteItem(@PathParam("id") String itemId); } >> >> >> HelloRESTImpl.java: >> >> @Scope("COMPOSITE") public class HelloRESTImpl implements HelloREST { >> @Init public void init() { >> System.out.println("INIT"); } public void addItem(Item >> item) { System.out.println("add"); } public void >> deleteItem(String itemId) { System.out.println("delete"); } >> public String getAll() { return "ALL"; } public String >> getItemById(String itemId) { return itemId; } public void >> updateItem(Item item) { System.out.println("update"); } } >> >> >> >> Thanks >> Alex >
