Hi, I am still trying to get REST working in Tuscany M5.
I changed the tuscany-binding-rest-runtime-2.0-M5.jar Manifest file as attached. At first the org.apache.tuscany.sca.interfacedef.java;version=2.0.0 import was missing as filed in https://issues.apache.org/jira/browse/TUSCANY-3595. Secondly a package was resolved from a wrong bundle resulting in: java.lang.NoClassDefFoundError: org/apache/tuscany/sca/core/invocation/ProxyFactory The package org.apache.tuscany.sca.invocation is exported by org.apache.tuscany.sca.core bundle and org.apache.tuscany.sca.core.spi bundle. I have added following line in manifest to use the right bundle: Require-Bundle: org.apache.tuscany.sca.core Not sure if this should be done in that way... Nevertheless the next exception occurred and I don't know what to do for solving that issue. I attached the error log. Thanks in advance for some help. greetings, Alex Am 16.06.10 09:35 schrieb "Alexander Blotny" unter <[email protected]>: > 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(Bun>>> d >>> leContextImpl.java:916) >>> at >>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.>>> j >>> ava:220) >>> at >>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(L>>> i >>> stenerQueue.java:149) >>> at >>> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivile>>> g >>> ed(Framework.java:1350) >>> at >>> org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framew>>> o >>> rk.java:1301) >>> at >>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.j>>> a >>> va:362) >>> at >>> org.eclipse.osgi.framework.internal.core.AbstractBundle.updateWorker(Abstrac>>> t >>> Bundle.java:625) >>> at >>> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundl>>> e >>> .java:572) >>> at >>> org.eclipse.osgi.framework.internal.core.AbstractBundle.update(AbstractBundl>>> e >>> .java:555) >>> at >>> org.apache.felix.shell.impl.UpdateCommandImpl.execute(UpdateCommandImpl.java>>> : >>> 96) >>> at >>> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activa>>> t >>> 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.regi>>> s >>> terWithJAXRS(RESTServiceBindingProvider.java:217) >>> at >>> org.apache.tuscany.sca.binding.rest.provider.RESTServiceBindingProvider.star>>> t >>> (RESTServiceBindingProvider.java:143) >>> at >>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl$1.run(Compo>>> s >>> iteActivatorImpl.java:423) >>> at java.security.AccessController.doPrivileged(Native Method) >>> at >>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.startEndpoi>>> n >>> t(CompositeActivatorImpl.java:421) >>> at >>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo>>> s >>> iteActivatorImpl.java:377) >>> at >>> org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl.start(Compo>>> s >>> 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 >> >
Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: simon_laws Build-Jdk: 1.6.0_07 Extension-Name: tuscany-binding-rest-runtime Implementation-Title: Apache Tuscany SCA REST Binding Runtime Implementation-Vendor: The Apache Software Foundation Implementation-Vendor-Id: org.apache Implementation-Version: 2.0-M5 Specification-Title: Apache Tuscany SCA REST Binding Runtime Specification-Vendor: The Apache Software Foundation Specification-Version: 2.0-M5 Private-Package: org.apache.tuscany.sca.binding.rest.provider;version= "2.0.0",.;version="2.0.0" SCA-Version: 1.1 Bundle-Name: Apache Tuscany SCA REST Binding Runtime Bundle-Vendor: The Apache Software Foundation Bundle-Version: 2.0.0 Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA REST Binding Runtime Import-Package: javax.jws,javax.servlet,javax.servlet.http,javax.ws.rs ,javax.ws.rs.core,javax.ws.rs.ext,javax.xml,org.apache.tuscany.sca.as sembly;version="2.0.0",org.apache.tuscany.sca.binding.rest;version="2 .0.0",org.apache.tuscany.sca.binding.rest.operationselector.jaxrs;ver sion="2.0.0",org.apache.tuscany.sca.binding.rest.operationselector.rp c;version="2.0.0",org.apache.tuscany.sca.binding.rest.wireformat.json ;version="2.0.0",org.apache.tuscany.sca.binding.rest.wireformat.xml;v ersion="2.0.0",org.apache.tuscany.sca.common.http;version="2.0.0",org .apache.tuscany.sca.core;version="2.0.0",org.apache.tuscany.sca.datab inding;version="2.0.0",org.apache.tuscany.sca.databinding.javabeans;v ersion="2.0.0",org.apache.tuscany.sca.databinding.xml;version="2.0.0" ,org.apache.tuscany.sca.host.http;version="2.0.0",org.apache.tuscany. sca.interfacedef;version="2.0.0",org.apache.tuscany.sca.interfacedef. impl;version="2.0.0",org.apache.tuscany.sca.interfacedef.util;version ="2.0.0",org.apache.tuscany.sca.invocation;version="2.0.0",org.apache .tuscany.sca.provider;version="2.0.0",org.apache.tuscany.sca.runtime; version="2.0.0",org.apache.wink.client,org.apache.wink.client.handler s,org.apache.wink.common,org.apache.wink.server.utils,org.apache.wink .common.internal.registry,org.apache.wink.common.internal.registry.me tadata,org.apache.wink.server.internal,org.apache.wink.server.interna l.registry,org.apache.wink.server.internal.servlet,org.oasisopen.sca; version="2.0.0",org.oasisopen.sca.annotation;version="2.0.0", org.apache.tuscany.sca.interfacedef.java;version="2.0.0", org.apache.tuscany.sca.interfacedef.java.jaxrs;version="2.0.0" Bundle-SymbolicName: org.apache.tuscany.sca.binding.rest.runtime Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 Require-Bundle: org.apache.tuscany.sca.core
error.txt
Description: Binary data
