ant elder wrote:
On Sun, May 11, 2008 at 7:34 PM, Jean-Sebastien Delfino <
[EMAIL PROTECTED]> wrote:
ant elder wrote:
I've been trying to use the new distributed domain stuff -
domain-manager
and node2* etc - to get Tomcat as a domain manager with SCA webapps
being
individual nodes, but not really making much progress getting it to work
so
asking here to see if there are any suggestions - mainly from you
Sebastien
as you've written most of those new modules :-)
I'm going to send steps to show how to run an SCA node as a web app in a
different email.
Here's a scenario and detailed steps showing how to deploy and run the
tutorial's catalog-webapp on Tomcat and integrate it with the other
tutorial modules running on other nodes in the same SCA domain.
Note: I had to fix PackageTypeDescriberImpl as its support for WARs was
broken by a recent patch in SVN r641645 so these steps should work with
the 1.2 release and trunk but won't work with r641645 <= SVN < r655704.
First build a Tuscany distribution or just have Maven place all the
required Tuscany dependency JARs in a directory as follows:
cd tutorial/domain
mvn dependency:copy-dependencies
That will copy the required JARs to tutorial/domain/target/dependency.
Start the domain manager app as follows:
java -jar
<Tuscany distribution root or location of the JARs>
/tuscany-node2-launcher-2.0-incubating-SNAPSHOT.jar domain
Browse http://localhost:9990/ui/workspace/
You should see the tutorial contributions already deployed to the
tutorial SCA domain.
Browse http://localhost:9990/ui/cloud/ to see the SCA nodes declared in
the tutorial.
Check CurrencyNode and CatalogsNode
Press Start, the two nodes should appear as started (clicking the
started link shows their log).
cd tutorial/store-eu
Edit store-eu.composite and change:
<reference name="fruitsCatalog" target="FruitsCatalogWebService">
to
<reference name="fruitsCatalog" target="WebFruitsCatalog">
to make it use the catalog packaged in catalog-webapp.
mvn clean install to rebuild store-eu
Browse http://localhost:9990/ui/cloud/
Check StoreEUNode, press Start to start the store application.
Copy tutorial/catalog-webapp/target/tutorial-catalog-webapp.war to
CatalogWebAppNode.war in some folder.
If you open CatalogWebAppNode.war you'll see that it only contains a
minimum of Tuscany runtime JARs (basically just the API JARs needed to
compile application code like JSPs for example) and a Tuscany launcher
JAR, responsible for launching the SCA node inside the Webapp.
CatalogWebAppNode is the name of the SCA node allocated to the
catalog-webapp composite. Having the Web context named CatalogWebAppNode
tells the launcher that it's dealing with CatalogWebAppNode. It also
makes it easy to find, manage, start/stop these Tomcat nodes using the
Tomcat manager app.
You can also deploy the same composite Webapp to multiple nodes this
way, you just need to name use the proper Web context name when you're
deploying the Webapp to the Web container.
Note that other application servers like WebSphere or Geronimo (IIRC)
allow you to set the Web context name without renaming the WAR. It may
be possible to do the same with Tomcat too using a Tomcat deployment
descriptor, I'm not sure but anyway I think that there's more power in
being portable and Web server independent here, as an SCA domain can
include many servers of different types.
Configure environment variable TUSCANY_HOME=<location of the JARs used
earlier> or <root of Tuscany distribution install>. This will tell the
launcher where to find these JARs, as an alternative to shared libraries
that are not supported by all servers.
Start Tomcat
Deploy CatalogWebAppNode.war to Tomcat, it should start right away.
Browse http://localhost:8080/CatalogWebAppNode/
You should see a catalog of fruits.
Browse http://localhost:8104/ui/store-eu.html
You should see the store catalog, listing some fruits and vegetables.
Assuming that everything worked to this point, you've basically run 4
SCA nodes, 3 running as J2SE standalone nodes and one running as a
webapp on Tomcat.
Here are the details:
- The store widget component runs in your Web browser;
- The widget talks to the store components running on a 1st standalone
SCA node;
- The store components use two catalogs, a vegetables catalog running on
a 2nd standalone SCA node and a fruits catalog running on a 3rd SCA
node, configured as a Webapp on Tomcat;
- Both catalogs use the same currency converter service running on a
fourth standalong SCA node.
In addition to Webapp deployment this scenario also showed the ability
to start nodes in any order - you can try different sequences :) - and
update and rewire a composite already deployed to the domain (store-eu
was updated and rebuilt then changes were picked up without having to
redeploy it).
The same steps work with Geronimo and WebSphere. On WebSphere you just
need to configure a shared library pointing to the Tuscany JARs and
dependencies.
Hope this helps.
P.S. I'll try to send a variation of these steps later that show how you
can run SCA nodes in Webapps without exposing any of the Webapp
specifics to the application developer (basically you just work with
plain contribution JARs). I meant to do that today but was just too busy
to get to it.
--
Jean-Sebastien