cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Rigby" <>
Subject Tutorial and Tomcat deployment
Date Tue, 17 Nov 2009 16:38:23 GMT
Suffering great frustration deploying Cocoon 2.2 to Tomcat.   Reverted to
the tutorial to check the basics.  Hope following notes will help someone
else avoid pain.


- SUMMARY -------------------

A. Tutorial page 1.  Welcome page has a link to spring bean 
which fails if called from


but succeeds when called from   
Link is not properly fixed up.  See #2 below.
B. Tutorial page 4. Parent POM fails to compile myCocoonWebapp.
Cannot find correct version of maven-war-plugin.  Solutions found 
on mailing list do not work.  See #5 below.

C. <servlet:context/@mount-path="" ...> is not sufficient to mount
the web app as ROOT in Tomcat.  The war file must be ROOT.war
(or the app must be deployed with a context fragment from
elsewhere in the file system).  See #7 below.

D. <finalName>ROOT</finalName> is not sufficient to mount
the web app as ROOT in Jetty.  Change <webAppSourceDirectory/>.  
See #9 below.

E. Tomcat does not unpack ROOT.war if there is a context 
fragment ROOT.xml.  Check and remove the conflicting file.
See #10 below.

F. <finalName>ROOT</finalName> is not sufficient to deploy
the web app as ROOT in Tomcat with tomcat-maven-plugin.  
Add context path. See #12 below.  

- START ----------------------

1.  Create new tutorial blocks



2.  Run under Jetty + rcl

  cd {...}/myBlock1
  mvn compile jetty:run

browse to 


works fine                      <--- OK

But note that 


works OK (without trailing slash) but then the
link to the Spring bean fails

  http://localhost:8888/spring-bean   <--- FAIL

instead of


This is not good on page one of the tutorial.

3.  Add webapp block and parent POM



4.  Run under Jetty + war file

  cd {...}/myBlock1
  mvn install
  cd {...}/myBlock2
  mvn install
  cd {...}/myCocoonWebApp
  mvn package jetty:run

browse to 


works fine                      <--- OK

5.  Reactor build from parent POM

  cd {...}
  mvn install

Build fails with           <-- FAIL

  Internal error in the plugin manager 
    executing goal 'org.apache.maven.plugins:maven-war-plugin:2.0.2:war': 
    Unable to find the mojo
    in the plugin 'org.apache.maven.plugins:maven-war-plugin'
  Component descriptor cannot be found in the component repository: 

This has been an unsolved problem since I first tested Cocoon 2.2.  There
are two 
issues here:  

  i.  The tutorial fails [on my machine] despite the standardisation offered
by Maven.
  ii. The requested plugin is not found in the (any?) repository.

6.  There two solutions at

Neither one works.  The second solution changes the version number in the
message from 2.0.2 to 2.1-beta-1.

7.  Work around.  Go back to 4 above and copy


to {tomcat 5.5.20}/webapps. Browse to

  http://localhost:8080/           <-- FAIL

Get error 404 from Tomcat.  But browse to


and it finds the page.  Tomcat ignores the servlet:context/@mount-path="" 
attribute in block-servlet-service.xml

8.  Rename the WAR file ROOT.xml by setting 


in the POM for myCocoonWebApp.  See

9.  Test with

  cd {...}/myCocoonWebApp
  mvn clean install jetty:run

This fails with          <-- FAIL

  Webapp source directory 
    does not exist

Maven has built a ROOT directory and ROOT.war but installed
in the repository (which could be OK).  Jetty has not recognized the
Fix this by changing maven-jetty-plugin in 








Browse to

  http://localhost:8080/           <-- OK

10. Test by copying 


to {tomcat 5.5.20}/webapps. Browse to

  http://localhost:8080/           <-- FAIL

and Tomcat has not unpacked ROOT.war, though it unpacked the other 
(see #7, above).

Restart Tomcat.  No mention of ROOT.war in {tomcat 5.5.20}/logs.

Check {tomcat 5.5.20}/conf/{engineName}/{hostName} for ROOT.xml.  Remove it.
Tomcat unpacks ROOT.war. Browse to

  http://localhost:8080/           <-- SUCCESS

11. OK, now remove ROOT.war and ROOT subdirectory from {tomcat
Log in to the Tomcat manager




Browse to

  http://localhost:8080/           <-- OK

12. Again, remove ROOT.war and ROOT subdirectory from {tomcat
Add in 




a new plugin


Set up the server tomcat-local in your Maven settings file



a new server


All as given at

Deploy with

  cd {...}/myCocoonWebApp
  mvn tomcat:deploy

Browse to

  http://localhost:8080/           <-- FAIL

The plugin has ignored <finalName/>.  Maven has again built a 
ROOT directory and ROOT.war but installed myCocoonWebApp.war
which works fine but is not required.

Browse to

  http://localhost:8080/myCocoonWebApp/       <-- OK but not useful

Add the context path


Redeploy with

  mvn tomcat:redeploy

Browse to

  http://localhost:8080/           <-- QED

- END -----------

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message