cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Robson <>
Subject Re: Deploying Cocoon 2.2 to tomcat
Date Thu, 05 Nov 2009 13:50:47 GMT
Hi Dom,

On 5 Nov 2009, at 10:01, Dominic Mitchell wrote:
> You can probably arrange to deploy a built war file straight into a  
> running tomcat.  The docs suggest it should be as simple as "mvn  
> tomcat:deploy".
> I have heard of other people using the cargo plugin successfully (on  
> the maven mailing list).  In case you can't get the tomcat plugin to  
> do what you want, it may be an alternative.

Thanks I will give the cargo plugin a go.

> I've had the deployment working before but now I need to use xpatch  
> which requires the cocoon maven pugin to run to patch the web.xml.  
> So my problem is if I need the cocoon maven plugin to run the  
> packaging type needs to be jar but if I want to deploy to tomcat  
> then the packaging type needs to be war.
> You shouldn't need to use xpatch in the webapp module.  In the  
> webapp, you have full control of web.xml (under src/main/webapp/WEB- 
> INF/web.xml), so it's not necessary.
> You shouldn't have the cocoon maven plugin enabled in the webapp  
> project at all.  I went through the tutorial a little while back and  
> uploaded the result to github:

I had a look at your example and my block and webapp is setup the same  
way but the only difference is I have a servlet in the block and I  
want to deploy it to tomcat.

> Are you trying to use tomcat for development?  I think that the  
> cocoon-maven-plugin is pretty much hard-wired to use jetty.   
> Deploying to tomcat is fine, but it does require building a full war  
> file, and then deploying that.  You won't get the same interactive  
> reloading that you do with jetty and the cocoon plugin.

No I use jetty for development and then deploy it to tomcat when I'm  
finished. Some more details on my application; I have one block called  
offair_maintance and a webapp block called zoidberg_cocoon.

Block1 offair_maintance (packaging type jar)

In here I've got some XML and XSL plus sitemap and a servlet with the  
following xweb:

<xweb xpath="/web-app" insert-after="servlet[last()]">
     <display-name>Upload XML</display-name>


so when developing on jetty I can go to http://localhost:8888/offair_maintance/upload/10/2009/MRR.xml

  which access the servlet and works great. The problem comes when I  
try to deploy to tomcat using the zoidberg_cocoon webapp.

Webapp block zoidberg_cocoon (packaging type war)

In here I add the dependency to offair_maintance in the pom.xml:


then assuming I set the package type to war I can run:

mvn tomcat:deploy

and when I look on tomcat the offair_maintance block works OK apart  
from the servlet which gives a no pipeline error. When I look in the  
zoidberg_cocoon target directory I can see the UploadXML servlet isn't  
in the web.xml because the cocoon maven plugin hasn't run the  
UploadXML.xweb. If I change the packaging type to jar and run mvn  
jetty:run on the zoidberg_cocoon project then the servlet does work.

So is the only solution (assuming the cargo plugin doesn't fix this  
problem) to edit the web.xml in zoidberg_cocoon and all the servlets  
which are defined in the blocks I reference?

Thanks for your help and I hope the above explanation makes sense.



View raw message