Its hard to work out whats going on without seeing the code, would it
be possible for you to raise a JIRA and attach your source or the
built .war file to that so we can debug it ourselves? You can create a
jira at https://issues.apache.org/jira/browse/Tuscany

   ...ant

2010/7/21 Tyrone <tyroneg...@gmail.com>:
> Hi,
>
>     I wrote one service "Service3", it uses remote web service "Service1"
> and "Service2".
> It works well when I start it in standalone JVM.
> Now I want to write a web client for "Service3".
> I read the webapps\helloworld-servlet and use implementation.web for the web
> client.
> But I met some problems.
> 1. My composite for the web client is like the following
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>     <component name="foo">
>         <implementation.web web-uri=""/>
>         <reference name="service3" target="Service3Component" />
>     </component>
>     <component name="Service3Component">
>         <implementation.java class="Service3Impl"/>
>         <reference name="service2">
>             <interface.java interface="Service2Interface" />
>             <binding.ws uri=uri of service2 />
>         </reference>
>         <reference name="service1">
>             <interface.java interface="Service1Interface" />
>             <binding.ws uri=uri of service1 />
>         </reference>
>     </component>
>
>   //** Service2 interface
>   public interface Service2Interface{
>       public Message[] getMessages(UserData userData, int count);
>   }
> -------------------------------------------------------------------------------------------------------------------------------------------------
>   //** Service1 interface
>   public interface Service1Interface{
>       public String getResult(String iputText);
>   }
>
>   //** Service3 interface
>   public interface Service3Interface{
>       public String[] getProcessedResult(String username, String password,
> int count);
>   }
>
>   //** this service calls Service2 to get messages and send each message to
> Service1 to get
>   // processed result. Service3 returns the processed result as a String
> array.
>   public class Service3Impl implements Service3Interface{
>       @Reference
>       private Service2 service2;
>       @Reference
>       private Service1 service1;
>
>       public String[] getProcessedResult(String username, String password,
> int count){
>             UserData userData = new UserData();
>             userData.setUsername(username);
>             userData.setPassword(password);
>             Message[] messages = service2.getMessages(userData, count);
>             String[] result = new String[messages.length];
>             for(int i=0; i < messages.length; i++){
>                   result[i] = service1.getResult( messages[i].getText() );
>             }
>             return result;
>       }
>   }
> --------------------------------------------------------------------------------------------------------------------------------------------------
>   I used self defined POJOs in Service2Interface, such as Message and
> UserData.
>   It works well in standalone JVM. I do not need to concern the
> transformation of self defined POJOs between Service3
>       and Service2.  It seems that Tuscany do these transformation itself...
>   But when I use this in implementation.web, I got
> "java.lang.IllegalArgumentException: Argument is not an array" in
>   Service3 at line "Message[] messages = service2.getMessages(userData,
> count);".
>   I tried to comment this line and set the messages by myselt, then it
> works.
>   I don't know why this exception happens. In standalone JVM it works well.
>   Anyone please tell me....
>
> 2.  In the webapps\helloworld-servlet sample, I copy all of the jar of
> 2.0.M5 into WEB-INF\lib(in eclipse)
>     but it can not work.
>     It works when I use the maven generated jar
> "tuscany-base-nodep-2.0-M5.jar" or "tuscany-base-2.0-M5.jar".
>     This seems not make sense, I used the whole lib of 2.0.M5.
>     Anbody can tell me why?
>
> PS. I use eclipse and have not learn maven until now.
>    The error message is in the following
> -----------------------------------------------------------------------------------------------------------------------------------------------------
> INFO: StandardWrapper.Throwable
> java.lang.NullPointerException at
> org.apache.tuscany.sca.implementation.web.runtime.ComponentContextProxy.getService(ComponentContextProxy.java:66)
>     at sample.HelloworldServlet.init(HelloworldServlet.java:46)
>     at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
>     at
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
>     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
>     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
>     at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>     at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>     at java.lang.Thread.run(Thread.java:619)
> 2010/7/21 下午 03:57:58 org.apache.catalina.core.StandardWrapperValve invoke
> INFO: Allocate exception for servlet HelloworldServlet
> java.lang.NullPointerException  at
> org.apache.tuscany.sca.implementation.web.runtime.ComponentContextProxy.getService(ComponentContextProxy.java:66)
>     at sample.HelloworldServlet.init(HelloworldServlet.java:46)
>     at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
>     at
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
>     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
>     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
>     at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>     at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>     at java.lang.Thread.run(Thread.java:619)
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Thanks,
> Tyrone
>

Reply via email to