Monosij Dutta-Roy wrote:
hi Simon -
Thanks for your clarifications. I will try to build upon it.
Also I had tried the @Service(QueryService.class) you mentioned and
tried it again but I still get the same exception.
I did a clean before deploy as well.
I am attaching the composite and the interface and the class - just in
case I missed anything - but its pretty much same as HelloWorld example
webapp with the QuerySevice interface and classes and query.jsp
I even tried variation the target from the jsp.
<!--reference name="service"
target="QueryServiceComponent/QueryService"/-->
<reference name="service" target="QueryServiceComponent"/>
And am attaching the POM as well.
Thanks Simon.
The problem is in the query.jsp file. You need to change the line
<sca:reference name="service" type="org.rd.qm.impl.QueryServiceImpl" />
to
<sca:reference name="service" type="org.rd.qm.QueryService" />
Simon
monosij
On Mon, Apr 11, 2011 at 3:50 PM, Simon Nash <n...@apache.org
<mailto:n...@apache.org>> wrote:
Hi Monosij,
See comments inline.
Simon
Monosij Dutta-Roy wrote:
hi Ant, Simon -
I wanted to get back to you regards your answers on creating the
webapp with multiple components.
I hope you remember my situation with the webapp running
multiple contributions that I contacted you last week about.
---------------------------
As per Ant's suggestion I moved to Tuscany version -- > 2.0-Beta2
And also updated namespace as: -->
xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
Also should this change to 2.0 or some other?
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
1.1 should be fine.
However now the basic webapp while deploys in Jetty - gives an
error on invocation:
Problem accessing /qmAppSCA01/. Reason:
java.lang.IllegalArgumentException: Business interface
org.rd.qm.impl.QueryServiceImpl is not compatible with
org.rd.qm.QueryService
I have not changed the interface and classes at all from my
previous version which used to be invoked fine by the JSP. Again
this is the basic Tuscany webapp template created by Maven.
---------------------------
I have the @Remotable on the interface org.rd.qm.QueryService as
below:
@Remotable
public interface QueryService {
String getPatients();
}
and the impl:
public class QueryServiceImpl implements QueryService {
public String getPatients() {
return "Got Patient!";
}
}
---------------------------
The qmAppSCA01.composite is attached.
Again - this basic webapp configuration was working fine in M4
which I was running before. Am I missing something?
>
I think you may need to add the annotation @Service(QueryService.class)
to the QueryServiceImpl class. This changed in the OASIS SCA specs
some time ago, and it may be that this change wasn't in 2.0-M4 but is
in 2.0-Beta2.
---------------------------
Also regards my initial queries ANT ELDER wrote:
There is a way to do this since 2.0-M5 by putting the
contributions into a folder name WEB-INF/sca-contributions.
There is a sample which demonstrates this that we have just
added to the trunk samples, so its pom.xml shows what you need
to do, see
https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-webapp/
-----
I haven't gotten there yet.
However SIMON NASH wrote:
My understanding is that the JSP invokes QueryService correctly,
but QueryService can't invoke QueryController because
QueryController isn't part of the same webapp. To fix this, you
could expose QueryController using an interoperable binding such
as binding.ws <http://binding.ws> <http://binding.ws>, and
configure the reference in QueryService to also use binding.ws
<http://binding.ws> <http://binding.ws> with an endpoint URI
that matches the deployment URI for QueryController. You would
also need to use a separate Tuscany domain (not part of the
webapp) to load and deploy QueryController.
In Tuscany 2.x (not 1.x) there is an SCA client API which allows
you to invoke SCA services running in a different SCA domain.
This is intended for use from non-SCA code, such as a servlet
running in a webapp. As you are using some SCA code within the
webapp (though only as a UI front end) I think it's better to
use an interoperable binding to invoke
QueryController rather than using the SCA client API.
---------------------------
Clarification seeking on which is the way to go - with my
interpretation as:
ANT's statement says that with 2.0-Beta2 I should be able to do
multiple components / composites for a webapp as long as I put
them in the WEB-INF/sca-contributions folder. So it should work
just by putting it there and I intend to try it out as per the
example.
However, I am interpreting SIMON's statement as a best practice
- and will be necessary to run the QueryController in a scalable
manner such as multiple nodes. So in this approach the
QueryController has nothing to do with the webapp but will be
invoked by the webapp as needed through the binding.ws
<http://binding.ws> <http://binding.ws> - and this leaves me
free to change webapp framework / UI without worrying about
backend logic.
However just for now to get things running and make sure configs
and such are set correctly I can get by using the approach Ant
suggests. However this approach won't be scalable in a way SCA
is meant to scale - but will be good for the prototyping phase -
including set up db interconnectivity through DAS and such - and
then when ready figure out the deployment / scaling aspect in
running across multiple nodes put in the ws.bindings and
deployment scenarios.
Please let me know if my interpretation is correct.
---------------------------
Yes, that's a very good summary and it's exactly correct.
Simon
Again thanks for all your help and suggestions.
monosij