You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Rich Smith (rjsmith2)" <rj...@cisco.com> on 2008/08/12 22:06:21 UTC

Question on Tomcat / webapp support in SCA Java

Apologies in advance if I sound confused about this, but I cannot figure
out how to implement
a style of webapp that our product currently uses, and would like a
pointer.
 
I have looked at the calculator-webapp sample, and I can see that it
instantiates the SCA runtime
inside of a webapp, which is not what I'm looking for.
 
I also see the runtime-tomcat module, which looks like an embedded
Tomcat container.  This
is closer, but it also appears to instantiate an SCA runtime per webapp.
 
What I would like to do is to start the SCA runtime with Tomcat
embedded, and have one
instance of the SCA runtime that can be accessed by all of the webapps
that are running in the
Tomcat container.  What I need is a way to access a global SCADomain
instance from any
webapp running in the embedded Tomcat container.
 
The idea here is that our application's services would be exposed using
SCA, and could be
accessed and invoked from any application running in the web front-end.
 
For example, we have a data access service that uses Hibernate ORM.
This has a global
configuration and session factory for our application data model and
connection pool to the
database.  I want to expose this as an SCA component + service
interface.  But, what I don't
want is to have to load up the Hibernate configuration and session
factory once for each
webapp, resulting in the same data model loaded multiple times and
multiple connection
pools to the database.
 
I want to have a single startup that creates the SCA runtime (creating
one instance of the
data access component), and then creates the embedded Tomcat container,
and then
somehow inject the global SCADomain instance into each application
context so that the
webapps can all access the same services.
 
Is this model supported, or is there a better model for supporting
something like this?  Where
should I look to get an example?
 
     --Rich
 

Re: Question on Tomcat / webapp support in SCA Java

Posted by ant elder <an...@apache.org>.
On Thu, Aug 14, 2008 at 10:09 PM, Rich Smith (rjsmith2)
<rj...@cisco.com>wrote:

<snip>


> I'd be interested if other users have any cases where multiple webapps
> would have to access a
> single SCADomain containing back-end services in the same JVM as the web
> container.
>
>

Yes, it comes up quite often, for example
http://apache.markmail.org/message/ttssxoruzpndkado

I think we will get this sorted out in Tuscany soon now that the SCA JEE
spec is out and we're getting more experience with Tuscanys current
distributed domain approach.

(I'm still thinking about your previous email)

   ...ant

RE: Question on Tomcat / webapp support in SCA Java

Posted by "Rich Smith (rjsmith2)" <rj...@cisco.com>.
To follow up on this, it looks like for the time being, our project will
be using a single webapp for
its UI front-end, and so it is okay to have an SCADomain per webapp
(since there will only be one).
 
I'd be interested if other users have any cases where multiple webapps
would have to access a
single SCADomain containing back-end services in the same JVM as the web
container.
 
     --Rich
 

________________________________

From: Rich Smith (rjsmith2) 
Sent: Wednesday, August 13, 2008 11:29 AM
To: user@tuscany.apache.org; antelder@apache.org
Subject: RE: Question on Tomcat / webapp support in SCA Java


Hi, thanks for the reply.
 
The second question first:  It's probably not okay to require a second
JVM.  Our current back-end services
run in the same JVM as the Tomcat server, which is embedded in our JVM.
Currently, we access the
back-end services using a singleton pattern because the webapp
classloader delegates to the global
classloader, and so we are able to see the services from the webapps.
In the SCA version of this, we would
like the back-end services to be injected into the webapp.  Also, just
as a general principle, requiring
separate JVMs would add communication overhead and complexity where it
may not be needed.
 
The first question is trickier.
 
My inclination is to say that it is probably okay to modify Tomcat to
support the Tuscany service injection,
but I do have some reservations about it, which I'll describe:
 
Among the other technologies we are looking to integrate with eventually
are Spring, OSGi, and ESB.
With the new version of ServiceMix Kernel coming out, the integration
between Spring DM, OSGi, and
ESB is fairly complete, with the OSGi runtime hosting all of the bundles
that are required to make all
of this run together.  I'm not sure if we'll use all of these
technologies, but I can see a picture developing
where we have a composite application using SCA that exposes JBI
endpoints, all running on OSGi.
The SCA application itself could be distributed, which would be managed
by SCA outside of the context
of how the components interact with the ESB.
 
In this type of system, Tomcat would be deployed as OSGi bundles, which
I believe are already
available from the Spring DM project, and so having the SCA runtime
require its own Tomcat server
would not be appropriate.  On the other hand, if the Tuscany jars could
be integrated with any Tomcat
server, such as the "bundlized" version that comes with Spring DM, then
that would be fine.
 
The other possibility in the OSGi scenario is that we would let Spring
DM manage the .war files,
and allow Spring DM to do the service injection, looking up services
from the OSGi service registry,
allowing all of that to happen outside of the context of SCA.  I'm not
sure if this will work, but it
sounds like it might.  (Do you have an opinion on this?  Can an OSGi
service exposed from SCA
be referenced by Spring DM?)
 
One concern I have about SCA and OSGi is how Apache Tuscany and Spring
DM will play together
on the same OSGi runtime.  Spring DM has a listener that instantiates a
Spring application context
for each "Spring-powered" OSGi bundle, and it also has some support for
listening for wepapp bundles
and activating those in a web container like Tomcat.  My understanding
is that in each of these cases,
Spring DM can use the OSGi service registry to expose Spring beans or
reference Spring beans as
OSGi services.
 
Up until now, I've pictured Spring DM as operating independently of SCA
in the same OSGi runtime,
but both interacting with the OSGi service registry.  However, if
Tuscany does "deep integration" with
Tomcat, I'm not sure how that would work with Spring DM's support for
Tomcat in an OSGi environment.
Would the integration affect or not affect the Spring DM support for
activating webapps from bundles?
 
When I looked at the current code for Tuscany webapp support, it looked
to me that it would not
work in a multiple classloader environment such as OSGi.  Really, the
SCADomain object, being global
to the JVM, would have to be exposed through the OSGi service registry
in the OSGi case, or (I'm not
sure if this works), registered in JNDI so that it can be globally
accessed across webapps.
 
I'm not sure if this answers your questions, but I hope it gives you an
idea of some of the issues we
are considering.
 
     --Rich
 
 
 


________________________________

From: ant elder [mailto:ant.elder@gmail.com] 
Sent: Wednesday, August 13, 2008 1:00 AM
To: user@tuscany.apache.org
Subject: Re: Question on Tomcat / webapp support in SCA Java


The JEE spec is quite new so we've not finished implementing it in
Tuscany yet. The implementation.web part is usable today though and
development continues. Its great you're asking and interested, the specs
are a bit vague in places and allow a lot of flexibility for how to do
things so having users state their requirements helps a lot.

Implementation.web is usable outside of a full JEE container, Tomcat and
plain webapps are fine, and i also want to have it working with the
Tuscany standalone Jetty/Tomcat hosts.

There's no Tuscany doc on it yet, but there are three samples that
demonstrate what it does so far: a servlet sample [1], a jsp sample [2],
and a jsonrpc sample [3]. From what you've said the servlet one is
closest to what you want and shows how to get the SCA ComponentContext
from ServletContext and use that to lookup SCA services and you should
be able to do something similar from your struts apps. 

As you've pointed out right now Tuscany webapp support only really works
well with each webapp using its own SCA domain, we need something more
than that to do what you're describing. To do this we have the Tuscany
distributed domain support and the runtime-tomcat module, neither of
which today support quite what you're asking for, but we can fix that.

A couple of questions:

- is it ok to require modification of the Tomcat system configuration,
for example, adding Tuscany jars and classes to the Tomcat
conf/server.xml or catalina.properties or adding a tuscany jar in the
Tomcat lib folder? If so some sort of Tuscany "deep" Tomcat integration
can be used as is done today by the Tuscany runtime-tomcat module.

- is it ok to require a separate JVM running outside of Tomcat to host
your Hibernate SCA services or would you prefer they run within the
Tomcat JVM instance?

If its ok to add a jar to the Tomcat server lib an easy way to get
something working right now would be to add class there which holds a
Tomcat global object and then use the Tuscany dynamic EndpointResolver
facility to look up SCA service endpoints from that global object. I
have some code already that does that type of thing i could probably
easily get it supporting what you've asked for if you're interested in
trying that?

Long term we need to get Tuscany webapp support more integrated into the
Tuscany distributed domain infrastructure. That should be happening as
part of the SCA JEE spec work but it will take a little time.

   ...ant



On Wed, Aug 13, 2008 at 2:00 AM, Rich Smith (rjsmith2)
<rj...@cisco.com> wrote:


	Hi, Luciano.  Thanks for the reference.  It clears up what the
overall
	plan is for SCA / Java EE integration.
	
	The only scenario we need for our application is to be able to
consume
	SCA-exposed services from a web component.  Section 5.4 of the
document
	explains it, where the web module is an implementation type, and
	service references are injected into the servlet, or available
to the
	JSP via a tag.
	
	My remaining question is whether or not this scenario will be
	implemented
	for deployments that use only Tomcat (plain web applications),
or if it
	will be necessary to use a full Java EE app server, such as
Geronimo.
	
	Some of the things I really like about Tuscany SCA Java are that
it
	doesn't
	lock the developer into a single technology, and it is also
lightweight.
	So, I'm hoping that it will be able to support
implementation.web
	without
	requiring a full Java EE server.
	
	Please let me know.  Thanks.
	
	    --Rich
	


	-----Original Message-----
	From: Luciano Resende [mailto:luckbr1975@gmail.com]
	Sent: Tuesday, August 12, 2008 5:06 PM
	To: user@tuscany.apache.org
	
	Subject: Re: Question on Tomcat / webapp support in SCA Java
	
	Some reference on the link below :
	
	
http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.
	pdf?version=1
<http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100
.pdf?version=1> 
	
	On Tue, Aug 12, 2008 at 4:49 PM, Rich Smith (rjsmith2)
	<rj...@cisco.com> wrote:
	> After poking around the web for more information on this
scenario, it
	> appears that what I'm talking about is <implementation.web>,
which is
	> not yet implemented, but is under development.  Am I correct
about
	> this?  Basically, each JVM would have one SCADomain, and each
webapp
	> would be an SCA component that the SCA runtime would wire to
any other
	
	> services, potentially using annotations in the servlet code.
	>
	> I came across this post, which seems to describe it:
	>
	>      I want to use a Web app in my SCA assembly and call SCA
	> components from it.
	>      I should be able to declare an SCA component representing
my Web
	> app, wire that
	>      component to other SCA components in the assembly, and
then
	> magically the wired
	>      references will be available as proxies for use in my
JSPs,
	> allowing me to call an SCA
	>      component using a simple jsp:useBean tag.
	>
	> Althought, our code would not directly call SCA components
from the
	> JSP, but rather from Struts action classes.
	>
	> How is the work progressing on this?  Will implementation.web
work
	> with a simple Tomcat container in addition to working with
something
	> heavier like Geronimo?
	>
	>      --Rich
	>
	> ________________________________
	> From: Rich Smith (rjsmith2)
	> Sent: Tuesday, August 12, 2008 1:06 PM
	> To: user@tuscany.apache.org
	> Subject: Question on Tomcat / webapp support in SCA Java
	>
	> Apologies in advance if I sound confused about this, but I
cannot
	> figure out how to implement a style of webapp that our product
	> currently uses, and would like a pointer.
	>
	> I have looked at the calculator-webapp sample, and I can see
that it
	> instantiates the SCA runtime inside of a webapp, which is not
what I'm
	
	> looking for.
	>
	> I also see the runtime-tomcat module, which looks like an
embedded
	> Tomcat container.  This is closer, but it also appears to
instantiate
	> an SCA runtime per webapp.
	>
	> What I would like to do is to start the SCA runtime with
Tomcat
	> embedded, and have one instance of the SCA runtime that can be
	> accessed by all of the webapps that are running in the Tomcat
	> container.  What I need is a way to access a global SCADomain
instance
	
	> from any webapp running in the embedded Tomcat container.
	>
	> The idea here is that our application's services would be
exposed
	> using SCA, and could be accessed and invoked from any
application
	> running in the web front-end.
	>
	> For example, we have a data access service that uses Hibernate
ORM.
	> This has a global
	> configuration and session factory for our application data
model and
	> connection pool to the database.  I want to expose this as an
SCA
	> component + service interface.
	> But, what I don't
	> want is to have to load up the Hibernate configuration and
session
	> factory once for each webapp, resulting in the same data model
loaded
	> multiple times and multiple connection pools to the database.
	>
	> I want to have a single startup that creates the SCA runtime
(creating
	
	> one instance of the data access component), and then creates
the
	> embedded Tomcat container, and then somehow inject the global
	> SCADomain instance into each application context so that the
webapps
	> can all access the same services.
	>
	> Is this model supported, or is there a better model for
supporting
	> something like this?  Where should I look to get an example?
	>
	>      --Rich
	>
	
	
	
	--
	Luciano Resende
	Apache Tuscany Committer
	http://people.apache.org/~lresende
<http://people.apache.org/%7Elresende> 
	http://lresende.blogspot.com/
	



RE: Question on Tomcat / webapp support in SCA Java

Posted by "Rich Smith (rjsmith2)" <rj...@cisco.com>.
Hi, thanks for the reply.
 
The second question first:  It's probably not okay to require a second
JVM.  Our current back-end services
run in the same JVM as the Tomcat server, which is embedded in our JVM.
Currently, we access the
back-end services using a singleton pattern because the webapp
classloader delegates to the global
classloader, and so we are able to see the services from the webapps.
In the SCA version of this, we would
like the back-end services to be injected into the webapp.  Also, just
as a general principle, requiring
separate JVMs would add communication overhead and complexity where it
may not be needed.
 
The first question is trickier.
 
My inclination is to say that it is probably okay to modify Tomcat to
support the Tuscany service injection,
but I do have some reservations about it, which I'll describe:
 
Among the other technologies we are looking to integrate with eventually
are Spring, OSGi, and ESB.
With the new version of ServiceMix Kernel coming out, the integration
between Spring DM, OSGi, and
ESB is fairly complete, with the OSGi runtime hosting all of the bundles
that are required to make all
of this run together.  I'm not sure if we'll use all of these
technologies, but I can see a picture developing
where we have a composite application using SCA that exposes JBI
endpoints, all running on OSGi.
The SCA application itself could be distributed, which would be managed
by SCA outside of the context
of how the components interact with the ESB.
 
In this type of system, Tomcat would be deployed as OSGi bundles, which
I believe are already
available from the Spring DM project, and so having the SCA runtime
require its own Tomcat server
would not be appropriate.  On the other hand, if the Tuscany jars could
be integrated with any Tomcat
server, such as the "bundlized" version that comes with Spring DM, then
that would be fine.
 
The other possibility in the OSGi scenario is that we would let Spring
DM manage the .war files,
and allow Spring DM to do the service injection, looking up services
from the OSGi service registry,
allowing all of that to happen outside of the context of SCA.  I'm not
sure if this will work, but it
sounds like it might.  (Do you have an opinion on this?  Can an OSGi
service exposed from SCA
be referenced by Spring DM?)
 
One concern I have about SCA and OSGi is how Apache Tuscany and Spring
DM will play together
on the same OSGi runtime.  Spring DM has a listener that instantiates a
Spring application context
for each "Spring-powered" OSGi bundle, and it also has some support for
listening for wepapp bundles
and activating those in a web container like Tomcat.  My understanding
is that in each of these cases,
Spring DM can use the OSGi service registry to expose Spring beans or
reference Spring beans as
OSGi services.
 
Up until now, I've pictured Spring DM as operating independently of SCA
in the same OSGi runtime,
but both interacting with the OSGi service registry.  However, if
Tuscany does "deep integration" with
Tomcat, I'm not sure how that would work with Spring DM's support for
Tomcat in an OSGi environment.
Would the integration affect or not affect the Spring DM support for
activating webapps from bundles?
 
When I looked at the current code for Tuscany webapp support, it looked
to me that it would not
work in a multiple classloader environment such as OSGi.  Really, the
SCADomain object, being global
to the JVM, would have to be exposed through the OSGi service registry
in the OSGi case, or (I'm not
sure if this works), registered in JNDI so that it can be globally
accessed across webapps.
 
I'm not sure if this answers your questions, but I hope it gives you an
idea of some of the issues we
are considering.
 
     --Rich
 
 
 


________________________________

From: ant elder [mailto:ant.elder@gmail.com] 
Sent: Wednesday, August 13, 2008 1:00 AM
To: user@tuscany.apache.org
Subject: Re: Question on Tomcat / webapp support in SCA Java


The JEE spec is quite new so we've not finished implementing it in
Tuscany yet. The implementation.web part is usable today though and
development continues. Its great you're asking and interested, the specs
are a bit vague in places and allow a lot of flexibility for how to do
things so having users state their requirements helps a lot.

Implementation.web is usable outside of a full JEE container, Tomcat and
plain webapps are fine, and i also want to have it working with the
Tuscany standalone Jetty/Tomcat hosts.

There's no Tuscany doc on it yet, but there are three samples that
demonstrate what it does so far: a servlet sample [1], a jsp sample [2],
and a jsonrpc sample [3]. From what you've said the servlet one is
closest to what you want and shows how to get the SCA ComponentContext
from ServletContext and use that to lookup SCA services and you should
be able to do something similar from your struts apps. 

As you've pointed out right now Tuscany webapp support only really works
well with each webapp using its own SCA domain, we need something more
than that to do what you're describing. To do this we have the Tuscany
distributed domain support and the runtime-tomcat module, neither of
which today support quite what you're asking for, but we can fix that.

A couple of questions:

- is it ok to require modification of the Tomcat system configuration,
for example, adding Tuscany jars and classes to the Tomcat
conf/server.xml or catalina.properties or adding a tuscany jar in the
Tomcat lib folder? If so some sort of Tuscany "deep" Tomcat integration
can be used as is done today by the Tuscany runtime-tomcat module.

- is it ok to require a separate JVM running outside of Tomcat to host
your Hibernate SCA services or would you prefer they run within the
Tomcat JVM instance?

If its ok to add a jar to the Tomcat server lib an easy way to get
something working right now would be to add class there which holds a
Tomcat global object and then use the Tuscany dynamic EndpointResolver
facility to look up SCA service endpoints from that global object. I
have some code already that does that type of thing i could probably
easily get it supporting what you've asked for if you're interested in
trying that?

Long term we need to get Tuscany webapp support more integrated into the
Tuscany distributed domain infrastructure. That should be happening as
part of the SCA JEE spec work but it will take a little time.

   ...ant



On Wed, Aug 13, 2008 at 2:00 AM, Rich Smith (rjsmith2)
<rj...@cisco.com> wrote:


	Hi, Luciano.  Thanks for the reference.  It clears up what the
overall
	plan is for SCA / Java EE integration.
	
	The only scenario we need for our application is to be able to
consume
	SCA-exposed services from a web component.  Section 5.4 of the
document
	explains it, where the web module is an implementation type, and
	service references are injected into the servlet, or available
to the
	JSP via a tag.
	
	My remaining question is whether or not this scenario will be
	implemented
	for deployments that use only Tomcat (plain web applications),
or if it
	will be necessary to use a full Java EE app server, such as
Geronimo.
	
	Some of the things I really like about Tuscany SCA Java are that
it
	doesn't
	lock the developer into a single technology, and it is also
lightweight.
	So, I'm hoping that it will be able to support
implementation.web
	without
	requiring a full Java EE server.
	
	Please let me know.  Thanks.
	
	    --Rich
	


	-----Original Message-----
	From: Luciano Resende [mailto:luckbr1975@gmail.com]
	Sent: Tuesday, August 12, 2008 5:06 PM
	To: user@tuscany.apache.org
	
	Subject: Re: Question on Tomcat / webapp support in SCA Java
	
	Some reference on the link below :
	
	
http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.
	pdf?version=1
<http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100
.pdf?version=1> 
	
	On Tue, Aug 12, 2008 at 4:49 PM, Rich Smith (rjsmith2)
	<rj...@cisco.com> wrote:
	> After poking around the web for more information on this
scenario, it
	> appears that what I'm talking about is <implementation.web>,
which is
	> not yet implemented, but is under development.  Am I correct
about
	> this?  Basically, each JVM would have one SCADomain, and each
webapp
	> would be an SCA component that the SCA runtime would wire to
any other
	
	> services, potentially using annotations in the servlet code.
	>
	> I came across this post, which seems to describe it:
	>
	>      I want to use a Web app in my SCA assembly and call SCA
	> components from it.
	>      I should be able to declare an SCA component representing
my Web
	> app, wire that
	>      component to other SCA components in the assembly, and
then
	> magically the wired
	>      references will be available as proxies for use in my
JSPs,
	> allowing me to call an SCA
	>      component using a simple jsp:useBean tag.
	>
	> Althought, our code would not directly call SCA components
from the
	> JSP, but rather from Struts action classes.
	>
	> How is the work progressing on this?  Will implementation.web
work
	> with a simple Tomcat container in addition to working with
something
	> heavier like Geronimo?
	>
	>      --Rich
	>
	> ________________________________
	> From: Rich Smith (rjsmith2)
	> Sent: Tuesday, August 12, 2008 1:06 PM
	> To: user@tuscany.apache.org
	> Subject: Question on Tomcat / webapp support in SCA Java
	>
	> Apologies in advance if I sound confused about this, but I
cannot
	> figure out how to implement a style of webapp that our product
	> currently uses, and would like a pointer.
	>
	> I have looked at the calculator-webapp sample, and I can see
that it
	> instantiates the SCA runtime inside of a webapp, which is not
what I'm
	
	> looking for.
	>
	> I also see the runtime-tomcat module, which looks like an
embedded
	> Tomcat container.  This is closer, but it also appears to
instantiate
	> an SCA runtime per webapp.
	>
	> What I would like to do is to start the SCA runtime with
Tomcat
	> embedded, and have one instance of the SCA runtime that can be
	> accessed by all of the webapps that are running in the Tomcat
	> container.  What I need is a way to access a global SCADomain
instance
	
	> from any webapp running in the embedded Tomcat container.
	>
	> The idea here is that our application's services would be
exposed
	> using SCA, and could be accessed and invoked from any
application
	> running in the web front-end.
	>
	> For example, we have a data access service that uses Hibernate
ORM.
	> This has a global
	> configuration and session factory for our application data
model and
	> connection pool to the database.  I want to expose this as an
SCA
	> component + service interface.
	> But, what I don't
	> want is to have to load up the Hibernate configuration and
session
	> factory once for each webapp, resulting in the same data model
loaded
	> multiple times and multiple connection pools to the database.
	>
	> I want to have a single startup that creates the SCA runtime
(creating
	
	> one instance of the data access component), and then creates
the
	> embedded Tomcat container, and then somehow inject the global
	> SCADomain instance into each application context so that the
webapps
	> can all access the same services.
	>
	> Is this model supported, or is there a better model for
supporting
	> something like this?  Where should I look to get an example?
	>
	>      --Rich
	>
	
	
	
	--
	Luciano Resende
	Apache Tuscany Committer
	http://people.apache.org/~lresende
<http://people.apache.org/%7Elresende> 
	http://lresende.blogspot.com/
	



Re: Question on Tomcat / webapp support in SCA Java

Posted by ant elder <an...@gmail.com>.
The JEE spec is quite new so we've not finished implementing it in Tuscany
yet. The implementation.web part is usable today though and development
continues. Its great you're asking and interested, the specs are a bit vague
in places and allow a lot of flexibility for how to do things so having
users state their requirements helps a lot.

Implementation.web is usable outside of a full JEE container, Tomcat and
plain webapps are fine, and i also want to have it working with the Tuscany
standalone Jetty/Tomcat hosts.

There's no Tuscany doc on it yet, but there are three samples that
demonstrate what it does so far: a servlet sample [1], a jsp sample [2], and
a jsonrpc sample [3]. From what you've said the servlet one is closest to
what you want and shows how to get the SCA ComponentContext from
ServletContext and use that to lookup SCA services and you should be able to
do something similar from your struts apps.

As you've pointed out right now Tuscany webapp support only really works
well with each webapp using its own SCA domain, we need something more than
that to do what you're describing. To do this we have the Tuscany
distributed domain support and the runtime-tomcat module, neither of which
today support quite what you're asking for, but we can fix that.

A couple of questions:

- is it ok to require modification of the Tomcat system configuration, for
example, adding Tuscany jars and classes to the Tomcat conf/server.xml or
catalina.properties or adding a tuscany jar in the Tomcat lib folder? If so
some sort of Tuscany "deep" Tomcat integration can be used as is done today
by the Tuscany runtime-tomcat module.

- is it ok to require a separate JVM running outside of Tomcat to host your
Hibernate SCA services or would you prefer they run within the Tomcat JVM
instance?

If its ok to add a jar to the Tomcat server lib an easy way to get something
working right now would be to add class there which holds a Tomcat global
object and then use the Tuscany dynamic EndpointResolver facility to look up
SCA service endpoints from that global object. I have some code already that
does that type of thing i could probably easily get it supporting what
you've asked for if you're interested in trying that?

Long term we need to get Tuscany webapp support more integrated into the
Tuscany distributed domain infrastructure. That should be happening as part
of the SCA JEE spec work but it will take a little time.

   ...ant


On Wed, Aug 13, 2008 at 2:00 AM, Rich Smith (rjsmith2)
<rj...@cisco.com>wrote:

> Hi, Luciano.  Thanks for the reference.  It clears up what the overall
> plan is for SCA / Java EE integration.
>
> The only scenario we need for our application is to be able to consume
> SCA-exposed services from a web component.  Section 5.4 of the document
> explains it, where the web module is an implementation type, and
> service references are injected into the servlet, or available to the
> JSP via a tag.
>
> My remaining question is whether or not this scenario will be
> implemented
> for deployments that use only Tomcat (plain web applications), or if it
> will be necessary to use a full Java EE app server, such as Geronimo.
>
> Some of the things I really like about Tuscany SCA Java are that it
> doesn't
> lock the developer into a single technology, and it is also lightweight.
> So, I'm hoping that it will be able to support implementation.web
> without
> requiring a full Java EE server.
>
> Please let me know.  Thanks.
>
>     --Rich
>
>
> -----Original Message-----
> From: Luciano Resende [mailto:luckbr1975@gmail.com]
> Sent: Tuesday, August 12, 2008 5:06 PM
> To: user@tuscany.apache.org
> Subject: Re: Question on Tomcat / webapp support in SCA Java
>
> Some reference on the link below :
>
> http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.
> pdf?version=1<http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.pdf?version=1>
>
> On Tue, Aug 12, 2008 at 4:49 PM, Rich Smith (rjsmith2)
> <rj...@cisco.com> wrote:
> > After poking around the web for more information on this scenario, it
> > appears that what I'm talking about is <implementation.web>, which is
> > not yet implemented, but is under development.  Am I correct about
> > this?  Basically, each JVM would have one SCADomain, and each webapp
> > would be an SCA component that the SCA runtime would wire to any other
>
> > services, potentially using annotations in the servlet code.
> >
> > I came across this post, which seems to describe it:
> >
> >      I want to use a Web app in my SCA assembly and call SCA
> > components from it.
> >      I should be able to declare an SCA component representing my Web
> > app, wire that
> >      component to other SCA components in the assembly, and then
> > magically the wired
> >      references will be available as proxies for use in my JSPs,
> > allowing me to call an SCA
> >      component using a simple jsp:useBean tag.
> >
> > Althought, our code would not directly call SCA components from the
> > JSP, but rather from Struts action classes.
> >
> > How is the work progressing on this?  Will implementation.web work
> > with a simple Tomcat container in addition to working with something
> > heavier like Geronimo?
> >
> >      --Rich
> >
> > ________________________________
> > From: Rich Smith (rjsmith2)
> > Sent: Tuesday, August 12, 2008 1:06 PM
> > To: user@tuscany.apache.org
> > Subject: Question on Tomcat / webapp support in SCA Java
> >
> > Apologies in advance if I sound confused about this, but I cannot
> > figure out how to implement a style of webapp that our product
> > currently uses, and would like a pointer.
> >
> > I have looked at the calculator-webapp sample, and I can see that it
> > instantiates the SCA runtime inside of a webapp, which is not what I'm
>
> > looking for.
> >
> > I also see the runtime-tomcat module, which looks like an embedded
> > Tomcat container.  This is closer, but it also appears to instantiate
> > an SCA runtime per webapp.
> >
> > What I would like to do is to start the SCA runtime with Tomcat
> > embedded, and have one instance of the SCA runtime that can be
> > accessed by all of the webapps that are running in the Tomcat
> > container.  What I need is a way to access a global SCADomain instance
>
> > from any webapp running in the embedded Tomcat container.
> >
> > The idea here is that our application's services would be exposed
> > using SCA, and could be accessed and invoked from any application
> > running in the web front-end.
> >
> > For example, we have a data access service that uses Hibernate ORM.
> > This has a global
> > configuration and session factory for our application data model and
> > connection pool to the database.  I want to expose this as an SCA
> > component + service interface.
> > But, what I don't
> > want is to have to load up the Hibernate configuration and session
> > factory once for each webapp, resulting in the same data model loaded
> > multiple times and multiple connection pools to the database.
> >
> > I want to have a single startup that creates the SCA runtime (creating
>
> > one instance of the data access component), and then creates the
> > embedded Tomcat container, and then somehow inject the global
> > SCADomain instance into each application context so that the webapps
> > can all access the same services.
> >
> > Is this model supported, or is there a better model for supporting
> > something like this?  Where should I look to get an example?
> >
> >      --Rich
> >
>
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>

RE: Question on Tomcat / webapp support in SCA Java

Posted by "Rich Smith (rjsmith2)" <rj...@cisco.com>.
Hi, Luciano.  Thanks for the reference.  It clears up what the overall
plan is for SCA / Java EE integration.

The only scenario we need for our application is to be able to consume
SCA-exposed services from a web component.  Section 5.4 of the document
explains it, where the web module is an implementation type, and
service references are injected into the servlet, or available to the
JSP via a tag.

My remaining question is whether or not this scenario will be
implemented
for deployments that use only Tomcat (plain web applications), or if it
will be necessary to use a full Java EE app server, such as Geronimo.

Some of the things I really like about Tuscany SCA Java are that it
doesn't
lock the developer into a single technology, and it is also lightweight.
So, I'm hoping that it will be able to support implementation.web
without
requiring a full Java EE server.

Please let me know.  Thanks.

     --Rich


-----Original Message-----
From: Luciano Resende [mailto:luckbr1975@gmail.com] 
Sent: Tuesday, August 12, 2008 5:06 PM
To: user@tuscany.apache.org
Subject: Re: Question on Tomcat / webapp support in SCA Java

Some reference on the link below :

http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.
pdf?version=1

On Tue, Aug 12, 2008 at 4:49 PM, Rich Smith (rjsmith2)
<rj...@cisco.com> wrote:
> After poking around the web for more information on this scenario, it 
> appears that what I'm talking about is <implementation.web>, which is 
> not yet implemented, but is under development.  Am I correct about 
> this?  Basically, each JVM would have one SCADomain, and each webapp 
> would be an SCA component that the SCA runtime would wire to any other

> services, potentially using annotations in the servlet code.
>
> I came across this post, which seems to describe it:
>
>      I want to use a Web app in my SCA assembly and call SCA 
> components from it.
>      I should be able to declare an SCA component representing my Web 
> app, wire that
>      component to other SCA components in the assembly, and then 
> magically the wired
>      references will be available as proxies for use in my JSPs, 
> allowing me to call an SCA
>      component using a simple jsp:useBean tag.
>
> Althought, our code would not directly call SCA components from the 
> JSP, but rather from Struts action classes.
>
> How is the work progressing on this?  Will implementation.web work 
> with a simple Tomcat container in addition to working with something 
> heavier like Geronimo?
>
>      --Rich
>
> ________________________________
> From: Rich Smith (rjsmith2)
> Sent: Tuesday, August 12, 2008 1:06 PM
> To: user@tuscany.apache.org
> Subject: Question on Tomcat / webapp support in SCA Java
>
> Apologies in advance if I sound confused about this, but I cannot 
> figure out how to implement a style of webapp that our product 
> currently uses, and would like a pointer.
>
> I have looked at the calculator-webapp sample, and I can see that it 
> instantiates the SCA runtime inside of a webapp, which is not what I'm

> looking for.
>
> I also see the runtime-tomcat module, which looks like an embedded 
> Tomcat container.  This is closer, but it also appears to instantiate 
> an SCA runtime per webapp.
>
> What I would like to do is to start the SCA runtime with Tomcat 
> embedded, and have one instance of the SCA runtime that can be 
> accessed by all of the webapps that are running in the Tomcat 
> container.  What I need is a way to access a global SCADomain instance

> from any webapp running in the embedded Tomcat container.
>
> The idea here is that our application's services would be exposed 
> using SCA, and could be accessed and invoked from any application 
> running in the web front-end.
>
> For example, we have a data access service that uses Hibernate ORM.
> This has a global
> configuration and session factory for our application data model and 
> connection pool to the database.  I want to expose this as an SCA 
> component + service interface.
> But, what I don't
> want is to have to load up the Hibernate configuration and session 
> factory once for each webapp, resulting in the same data model loaded 
> multiple times and multiple connection pools to the database.
>
> I want to have a single startup that creates the SCA runtime (creating

> one instance of the data access component), and then creates the 
> embedded Tomcat container, and then somehow inject the global 
> SCADomain instance into each application context so that the webapps 
> can all access the same services.
>
> Is this model supported, or is there a better model for supporting 
> something like this?  Where should I look to get an example?
>
>      --Rich
>



--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Question on Tomcat / webapp support in SCA Java

Posted by Luciano Resende <lu...@gmail.com>.
Some reference on the link below :

http://www.osoa.org/download/attachments/35/SCA_JAVAEE_Integration_V100.pdf?version=1

On Tue, Aug 12, 2008 at 4:49 PM, Rich Smith (rjsmith2)
<rj...@cisco.com> wrote:
> After poking around the web for more information on this scenario, it
> appears that what
> I'm talking about is <implementation.web>, which is not yet implemented, but
> is under
> development.  Am I correct about this?  Basically, each JVM would have one
> SCADomain,
> and each webapp would be an SCA component that the SCA runtime would wire to
> any
> other services, potentially using annotations in the servlet code.
>
> I came across this post, which seems to describe it:
>
>      I want to use a Web app in my SCA assembly and call SCA components from
> it.
>      I should be able to declare an SCA component representing my Web app,
> wire that
>      component to other SCA components in the assembly, and then magically
> the wired
>      references will be available as proxies for use in my JSPs, allowing me
> to call an SCA
>      component using a simple jsp:useBean tag.
>
> Althought, our code would not directly call SCA components from the JSP, but
> rather
> from Struts action classes.
>
> How is the work progressing on this?  Will implementation.web work with a
> simple Tomcat
> container in addition to working with something heavier like Geronimo?
>
>      --Rich
>
> ________________________________
> From: Rich Smith (rjsmith2)
> Sent: Tuesday, August 12, 2008 1:06 PM
> To: user@tuscany.apache.org
> Subject: Question on Tomcat / webapp support in SCA Java
>
> Apologies in advance if I sound confused about this, but I cannot figure out
> how to implement
> a style of webapp that our product currently uses, and would like a pointer.
>
> I have looked at the calculator-webapp sample, and I can see that it
> instantiates the SCA runtime
> inside of a webapp, which is not what I'm looking for.
>
> I also see the runtime-tomcat module, which looks like an embedded Tomcat
> container.  This
> is closer, but it also appears to instantiate an SCA runtime per webapp.
>
> What I would like to do is to start the SCA runtime with Tomcat embedded,
> and have one
> instance of the SCA runtime that can be accessed by all of the webapps that
> are running in the
> Tomcat container.  What I need is a way to access a global SCADomain
> instance from any
> webapp running in the embedded Tomcat container.
>
> The idea here is that our application's services would be exposed using SCA,
> and could be
> accessed and invoked from any application running in the web front-end.
>
> For example, we have a data access service that uses Hibernate ORM.
> This has a global
> configuration and session factory for our application data model
> and connection pool to the
> database.  I want to expose this as an SCA component + service interface.
> But, what I don't
> want is to have to load up the Hibernate configuration and session factory
> once for each
> webapp, resulting in the same data model loaded multiple times and multiple
> connection
> pools to the database.
>
> I want to have a single startup that creates the SCA runtime (creating one
> instance of the
> data access component), and then creates the embedded Tomcat container, and
> then
> somehow inject the global SCADomain instance into each application context
> so that the
> webapps can all access the same services.
>
> Is this model supported, or is there a better model for supporting something
> like this?  Where
> should I look to get an example?
>
>      --Rich
>



-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

RE: Question on Tomcat / webapp support in SCA Java

Posted by "Rich Smith (rjsmith2)" <rj...@cisco.com>.
After poking around the web for more information on this scenario, it
appears that what
I'm talking about is <implementation.web>, which is not yet implemented,
but is under
development.  Am I correct about this?  Basically, each JVM would have
one SCADomain,
and each webapp would be an SCA component that the SCA runtime would
wire to any
other services, potentially using annotations in the servlet code.
 
I came across this post, which seems to describe it:
 
     I want to use a Web app in my SCA assembly and call SCA components
from it.
     I should be able to declare an SCA component representing my Web
app, wire that
     component to other SCA components in the assembly, and then
magically the wired
     references will be available as proxies for use in my JSPs,
allowing me to call an SCA
     component using a simple jsp:useBean tag. 
 
Althought, our code would not directly call SCA components from the JSP,
but rather
from Struts action classes.
 
How is the work progressing on this?  Will implementation.web work with
a simple Tomcat
container in addition to working with something heavier like Geronimo?
 
     --Rich
 

________________________________

From: Rich Smith (rjsmith2) 
Sent: Tuesday, August 12, 2008 1:06 PM
To: user@tuscany.apache.org
Subject: Question on Tomcat / webapp support in SCA Java


Apologies in advance if I sound confused about this, but I cannot figure
out how to implement
a style of webapp that our product currently uses, and would like a
pointer.
 
I have looked at the calculator-webapp sample, and I can see that it
instantiates the SCA runtime
inside of a webapp, which is not what I'm looking for.
 
I also see the runtime-tomcat module, which looks like an embedded
Tomcat container.  This
is closer, but it also appears to instantiate an SCA runtime per webapp.
 
What I would like to do is to start the SCA runtime with Tomcat
embedded, and have one
instance of the SCA runtime that can be accessed by all of the webapps
that are running in the
Tomcat container.  What I need is a way to access a global SCADomain
instance from any
webapp running in the embedded Tomcat container.
 
The idea here is that our application's services would be exposed using
SCA, and could be
accessed and invoked from any application running in the web front-end.
 
For example, we have a data access service that uses Hibernate ORM.
This has a global
configuration and session factory for our application data model and
connection pool to the
database.  I want to expose this as an SCA component + service
interface.  But, what I don't
want is to have to load up the Hibernate configuration and session
factory once for each
webapp, resulting in the same data model loaded multiple times and
multiple connection
pools to the database.
 
I want to have a single startup that creates the SCA runtime (creating
one instance of the
data access component), and then creates the embedded Tomcat container,
and then
somehow inject the global SCADomain instance into each application
context so that the
webapps can all access the same services.
 
Is this model supported, or is there a better model for supporting
something like this?  Where
should I look to get an example?
 
     --Rich