tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant elder <antel...@apache.org>
Subject Re: Webapp Configuration: with multiple Contribution / Composites
Date Tue, 05 Apr 2011 07:31:23 GMT
Yes exactly. I think thats an approach which fits in very well with
SCA and web applications.

One note, is that 2.0-Beta2 is the current latest release so thats
what you should move up to not M5 which is a little older now.

   ...ant

On Tue, Apr 5, 2011 at 3:36 AM, Monosij Dutta-Roy
<monosij.forums@gmail.com> wrote:
> hi Simon, AntElder -
> Thanks for your responses. I will take a couple of days and reconfigure it
> the way you mention with Tuscany 2.0 M5 and not M4.
> I also wanted to ask - is this a 'proper' architectural approach in
> developing a webapp?
> My reasoning is - this approach could help me swap out the interface layer
> (the webapp part of it) - with say Spring MVC or Struts or Guice and such.
> And allow scaling of the other composites (components) across one or more
> nodes.
> Once i get this webapp going I would like to approach it from a Spring MVC
> webapp perspective and keep the other composites as they are.
> Just wondering if you think that - that is a good approach - or should I be
> considering scaling and such from a different approach.
> Thanks.
> monosij
>
> On Mon, Apr 4, 2011 at 3:20 PM, ant elder <ant.elder@gmail.com> wrote:
>>
>> On Mon, Apr 4, 2011 at 6:00 PM, Monosij Dutta-Roy
>> <monosij.forums@gmail.com> wrote:
>> > hi Raymond
>> > Thanks for your response. I don't know if you got those composites from
>> > the
>> > war but here are my 3 composites attached.
>> > I think the references are ok. I did make sure they are.
>> > It is not the same as you show below - which means maybe there is maven
>> > packaging issue?
>> > The dependency is as follows: qmWebApp > qmController > entitBCA.
>> > I did a mvn clean - and mvn package - before a mvn jetty:run
>> > And to answer your ques - I have (as far as I understand) 1 web app -
>> > with 2
>> > dependent components.
>> > Yes they are to the same Jetty (under Maven).
>> > Hope that helps.
>> > I will be taking a look at the war file again and the composites in it
>> > when
>> > I get back later today.
>> > Thanks a lot.
>> > monosij
>> >
>> > On Mon, Apr 4, 2011 at 12:24 PM, Raymond Feng <enjoyjava@gmail.com>
>> > wrote:
>> >>
>> >> By looking at the web.composite file you have:
>> >> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
>> >>            xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
>> >>            targetNamespace="http://com.bca.app"
>> >>            name="qmApp">
>> >>     <!-- component name="qmAppWebComponent">
>> >>         <implementation.web web-uri=""/>
>> >>         <reference name="service" target="QueryServiceComponent"/>
>> >>     </component>
>> >>     <component name="QueryControllerComponent">
>> >>         <implementation.java class="com.bca.qm.QueryControllerImpl"/-->
>> >>     </component>
>> >>     <component name="QueryService">
>> >>         <implementation.java
>> >> class="com.bca.pearl.app.QueryServiceImpl"/>
>> >>     </component>
>> >> </composite>
>> >> There are two issues:
>> >> 1) The target attribute doesn't match the component name (red)
>> >> 2) There is no reference under QueryService component
>> >> to QueryControllerComponent
>> >> Thanks,
>> >> Raymond
>> >> ________________________________________________________________
>> >> Raymond Feng
>> >> rfeng@apache.org
>> >> Apache Tuscany PMC member and committer: tuscany.apache.org
>> >> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
>> >> Personal Web Site: www.enjoyjava.com
>> >> ________________________________________________________________
>> >> On Apr 4, 2011, at 8:33 AM, Monosij Dutta-Roy wrote:
>> >>
>> >> As requested here are the attached files.
>> >>
>> >> Thanks for taking a look at my war. Its attached along with the three
>> >> composites and two contributions.
>> >> It contains the dependent jars: entityBCA and qmController.
>> >> The errors I get is in the earlier part of the thread.
>> >> I am trying to create a basic db search app with three components.
>> >> So the structure is as follows:
>> >> ----------
>> >> entityBCA - domain.composite - sca-contribution.xml - pom.xml
>> >> has domain objects such as patients, addresses.
>> >> qmController - querycontroller.composite - sca-contribution.xml -
>> >> pom.xml
>> >> a search controller that has a searchComposer and searchExecutor.
>> >> qmApp - web.composite - no sca-contribution.xml
>> >> the webapp which passes the query to qmController
>> >> ----------
>> >> What I was trying to figure out is - as you show in the examples -
>> >> client
>> >> do the entityBCA and qmController need to be loaded as nodes?  Or does
>> >> Tuscany within Jetty already do it?
>> >> My goal is to keep the webapp framework - jsp / jsf and such completely
>> >> separate from the core components such that the front end technologies
>> >> can
>> >> be changed while configuring the other components to be run in a
>> >> distributed
>> >> environment.
>> >> ----------
>> >> My background is Java / C++ and somewhat new to the JEE frameworks such
>> >> as
>> >> Tuscany, Maven and such - so XML configs is a little new to me.
>> >> Thanks a lot!
>> >> monosij
>> >>
>> >> On Sun, Apr 3, 2011 at 10:26 AM, Simon Nash <nash@apache.org> wrote:
>> >>>
>> >>> Monosij Dutta-Roy wrote:
>> >>>>
>> >>>> New to Tuscany and following SCA in Action. Have a question on a
>> >>>> webapp
>> >>>> I created using the Maven tasks.
>> >>>> The webapp works fine as a single composite - broken up by several
>> >>>> components.
>> >>>> ------------------------
>> >>>> However when I create several composites (different contributions
>> >>>> using
>> >>>> Maven tasks) and wire them together - again webapp compiles and
sets
>> >>>> up in
>> >>>> Jetty fine. When I hit a component that has a reference in a separate
>> >>>> composite I get an error as below:
>> >>>> ------------------------
>> >>>> Problem accessing /qmApp/. Reason:
>> >>>>    org.oasisopen.sca.SCARuntimeException: Unable to bind
>> >>>> (@31214809)EndpointReference:  URI =
>> >>>> QueryServiceComponent#reference(queryController)
>> >>>> WIRED_TARGET_NOT_FOUND
>> >>>>  Target = (@3751575)Endpoint:  URI =
>> >>>> QueryController#service(QueryControllerService) [Unresolved]
>> >>>>
>> >>>> The QueryController/QueryControllerService is setup as a reference.
>> >>>> ------------------------
>> >>>> Its a small app and I have looked at the configs in detail and think
>> >>>> they are correct. Of course Maven compiles all of them fine - and
as
>> >>>> I said
>> >>>> deploys fine as well.
>> >>>>
>> >>>> However I am not sure I am loading the QueryController (the other
>> >>>> contribution/composite/reference - setup as a service) properly.
I
>> >>>> have
>> >>>> checked the composite file quite thoroughly and relevant code. I
can
>> >>>> upload
>> >>>> them if needed.
>> >>>> ------------------------
>> >>>> I assume when the war is build all the dependent jars are packaged
in
>> >>>> by
>> >>>> Maven and when Jetty starts the Tuscany API sorts out the
>> >>>> dependencies? Or
>> >>>> is there anything else I need to do for this quite simple setup?
But
>> >>>> a setup
>> >>>> that involves a webapp with different contributions.
>> >>>>
>> >>>> The reason I ask is also because the webapp generated by Maven does
>> >>>> not
>> >>>> have a sca-contribution.xml file where I import / export other
>> >>>> packages.
>> >>>> ------------------------
>> >>>> Thanks.
>> >>>>
>> >>> It would be very useful if you could upload the failing war file.
>> >>>  This
>> >>> might provide some important clues to the cause of the problem.
>> >>>
>> >>>  Simon
>> >>>
>> >>
>> >>
>> >>
>> >>
>> >> <qmApp-1.0-SNAPSHOT.war><qmApp-1.0-SNAPSHOT.pom><entityBCA-1.0-SNAPSHOT.pom><qmController-1.0-SNAPSHOT.pom>
>> >
>> >
>>
>> Hi monosij,
>>
>> I don't think Tuscany 1.x or 2.0-M4 supported multiple SCA
>> contribution within the WEB-INF/lib folder, there may be a way I'm not
>> remembering but I don't think so. If you put SCA contributions jars
>> into WEB-INF/lib they are just treated as regular jars not SCA
>> contributions and any .composite or sca-contribution.xml files within
>> are ignored.
>>
>> 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/
>>
>> Note that when you update to the later Tuscany 2.x releases that the
>> SCA namespace changed so you will need to update your contributions.
>> The change is in your .composite and sca-contribution.xml files should
>> have xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" - note
>> 12 at the end instead of the 03 that 2.0-M4 used.
>>
>> Give it a try with the latest Tuscany release - 2.0-Beta2 - and let us
>> know how you get on.
>>
>>   ...ant
>
>

Mime
View raw message