On Fri, May 23, 2008 at 11:53 PM, Raymond Feng <[EMAIL PROTECTED]> wrote:
> Hi, > > It's not clear from the SCA spec how generics impacts the interface > mapping. We need some clarifications there. > > The JAXWS 2.1 spec uses the erased type and only honor the type argument in > Collection. At this moment, Tuscany supports the following case: > > @Remotable > public interface MyHelloService extends HelloService<String> { > } > > And use MyHelloService as the service interface for HelloServiceImpl. Hmm... I tried this part and it does not seem to work. SCADomain.newInstance() is throwing an exception. Stack trace given below: org.osoa.sca.ServiceRuntimeException: org.osoa.sca.ServiceRuntimeException: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.NullPointerException at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:276) at org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:70) at org.apache.tuscany.sca.itest.DatabindingTestCase.setUp(DatabindingTestCase.java:39) at junit.framework.TestCase.runBare(TestCase.java:132) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.osoa.sca.ServiceRuntimeException: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.NullPointerException at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultSCADomain.java:239) at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(DefaultSCADomain.java:113) at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:242) ... 16 more Caused by: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.NullPointerException at org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate(CompositeActivatorImpl.java:986) at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultSCADomain.java:237) ... 18 more Caused by: java.lang.NullPointerException at org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl.getOperation(WSDLOperationIntrospectorImpl.java:212) at org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper.createWSDLInterfaceContract(Java2WSDLHelper.java:246) at org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider.<init>(Axis2ReferenceBindingProvider.java:56) at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingProviderFactory.createReferenceBindingProvider(Axis2BindingProviderFactory.java:66) at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingProviderFactory.createReferenceBindingProvider(Axis2BindingProviderFactory.java:46) at org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint$LazyBindingProviderFactory.createReferenceBindingProvider(DefaultProviderFactoryExtensionPoint.java:230) at org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.addReferenceBindingProvider(CompositeActivatorImpl.java:262) at org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate(CompositeActivatorImpl.java:142) at org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate(CompositeActivatorImpl.java:982) ... 19 more > > I don't think it's wise to try to cover other variations before we get it > clarified by the spec. > > Thanks, > Raymond > -------------------------------------------------- > From: "Vamsavardhana Reddy" <[EMAIL PROTECTED]> > Sent: Friday, May 23, 2008 10:42 AM > To: <tuscany-dev@ws.apache.org> > Subject: TransformationException when using java interface definition with > generics > > > Can someone point to me what I am doing wrong or if it is a problem in >> Tuscany? Details follow... >> >> I have the following service interface: >> @Remotable >> public interface HelloService<E> { >> public E getGreetings(E name); >> } >> -------- >> The following is the service implementation: >> @Service(HelloService.class) >> public class HelloServiceImpl implements HelloService<String> { >> >> public String getGreetings(String name) { >> return "Hello "+name; >> } >> } >> -------- >> The following is the client interface that invokes the service: >> public interface HelloServiceClient<E> { >> E getGreetingsForward(E name); >> } >> -------- >> The following is the client implementation: >> @Service(HelloServiceClient.class) >> public class HelloServiceClientImpl implements HelloServiceClient<String> >> { >> >> private HelloService<String> service; >> >> @Reference >> public void setHelloService(HelloService<String> service) { >> this.service = service; >> } >> >> public String getGreetingsForward(String name) { >> return service.getGreetings(name); >> } >> } >> -------- >> I have a HelloService component and two HelloServiceClient components in >> my >> composite (given below): >> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" >> xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" >> name="HelloService"> >> >> <!-- Clients to test the service --> >> <component name="HelloServiceClientWSComponent"> >> <implementation.java >> class="org.apache.tuscany.sca.itest.impl.HelloServiceClientImpl" /> >> <reference name="helloService"> >> <interface.java >> interface="org.apache.tuscany.sca.itest.HelloService"/> >> <binding.ws uri="http://localhost:8080/hs-ep1"/> >> </reference> >> </component> >> <component name="HelloServiceClientSCAComponent"> >> <implementation.java >> class="org.apache.tuscany.sca.itest.impl.HelloServiceClientImpl" /> >> <reference name="helloService" target="HelloServiceComponent"> >> <binding.sca/> >> </reference> >> </component> >> >> <!-- Components used to implement the services --> >> <component name="HelloServiceComponent"> >> <implementation.java >> class="org.apache.tuscany.sca.itest.impl.HelloServiceImpl"/> >> <service name="HelloService"> >> <interface.java >> interface="org.apache.tuscany.sca.itest.HelloService"/> >> <binding.ws uri="http://localhost:8080/hs-ep1"/> >> <binding.sca/> >> </service> >> </component> >> </composite> >> -------- >> The following is the code I am using to invoke the service via client >> components: >> domain = SCADomain.newInstance("hello.composite"); >> String name = "Me <String> SCA"; >> HelloServiceClient<String> helloServiceClient = >> domain.getService(HelloServiceClient.class, >> "HelloServiceClientSCAComponent"); >> String resp = helloServiceClient.getGreetingsForward(name); >> System.out.println(resp); >> >> name = "Me <String> WS"; >> helloServiceClient = domain.getService(HelloServiceClient.class, >> "HelloServiceClientWSComponent"); >> resp = helloServiceClient.getGreetingsForward(name); >> System.out.println(resp); >> -------- >> >> It works fine when I invoke the service using the client component that >> uses >> SCA binding to connect to the service. I get the following exception when >> I >> use the client component that uses WS binding. >> >> May 23, 2008 11:04:50 PM >> >> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver >> invokeBusinessLogic >> SEVERE: org.apache.tuscany.sca.databinding.TransformationException: No >> path >> found for the transformation: org.apache.axiom.om.OMElement->null >> org.osoa.sca.ServiceRuntimeException: >> org.apache.tuscany.sca.databinding.TransformationException: No path found >> for the transformation: org.apache.axiom.om.OMElement->null >> at >> >> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:119) >> at >> >> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:85) >> at >> >> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:79) >> at >> >> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:138) >> at >> >> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider.invokeTarget(Axis2ServiceProvider.java:669) >> at >> >> org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver.invokeBusinessLogic(Axis2ServiceInOutSyncMessageReceiver.java:68) >> at >> >> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42) >> at >> >> org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96) >> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145) >> at >> >> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) >> at >> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at >> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) >> at >> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) >> at >> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) >> at >> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) >> at >> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) >> at org.mortbay.jetty.Server.handle(Server.java:324) >> at >> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) >> at >> >> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) >> at >> >> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) >> at org.apache.tuscany.sca.core.work.Jsr237Work.run(Jsr237Work.java:63) >> at >> >> org.apache.tuscany.sca.core.work.ThreadPoolWorkManager$DecoratingWork.run(ThreadPoolWorkManager.java:221) >> at >> >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) >> at >> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) >> at java.lang.Thread.run(Thread.java:595) >> Caused by: org.apache.tuscany.sca.databinding.TransformationException: No >> path found for the transformation: org.apache.axiom.om.OMElement->null >> at >> >> org.apache.tuscany.sca.databinding.impl.MediatorImpl.getTransformerChain(MediatorImpl.java:162) >> at >> >> org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:67) >> at >> >> org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:181) >> at >> >> org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:45) >> at >> >> org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:79) >> at >> >> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.transform(DataTransformationInterceptor.java:186) >> at >> >> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:76) >> at >> >> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:110) >> ... 29 more >> >>