|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Deploying Cocoon 2.2 to tomcatHi,
I'm trying to deploy cocoon to tomcat but I seem to be getting a conflict with the packaging type and maven. If I want the cocoon RCL plugin to run then the package type needs to be jar but if I want to deploy to tomcat the package type needs to be war (in the pom.xml). I can get the code working if I use jetty as it doesn't seem to require a war package. The results after running mvn package with the package type set to war: [INFO] [cocoon:prepare {execution: prepare}] [INFO] Don't execute the Cocoon RCL plugin becaues either its packaging type is not 'jar' or there is no rcl.properties file in the block's base directory. The results of trying to deploy to tomcat if the project is set to jar: [INFO] [jar:jar] [INFO] Building jar: /Users/gmr/development/zoidberg_cocoon/target/ webapp-1.0.0.jar [INFO] [tomcat:redeploy] [INFO] Skipping non-war project The tomcat, jetty and cocoon details from the pom.xml are: 33 <plugin> 34 <groupId>org.apache.cocoon</groupId> 35 <artifactId>cocoon-maven-plugin</artifactId> 36 <version>1.0.0-M2</version> 37 <executions> 38 <execution> 39 <id>prepare</id> 40 <phase>compile</phase> 41 <goals> 42 <goal>prepare</goal> 43 </goals> 44 </execution> 45 </executions> 46 </plugin> 47 <plugin> 48 <groupId>org.mortbay.jetty</groupId> 49 <artifactId>maven-jetty-plugin</artifactId> 50 <version>6.1.7</version> 51 <configuration> 52 <connectors> 53 <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 54 <port>8888</port> 55 <maxIdleTime>30000</maxIdleTime> 56 </connector> 57 </connectors> 58 <webAppSourceDirectory>${project.build.directory}/rcl/ webapp</webAppSourceDirectory> 59 <contextPath>/</contextPath> 60 </configuration> 61 </plugin> 62 <plugin> 63 <groupId>org.codehaus.mojo</groupId> 64 <artifactId>tomcat-maven-plugin</artifactId> 65 <configuration> 66 <url>http://localhost:8080/manager</url> 67 <path>/cocoon-2.2</path> 68 <username>******</username> 69 <password>******</password> 70 </configuration> 71 </plugin> 72 <plugin> Any help would be greatly appreciated. Thanks Glen --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Deploying Cocoon 2.2 to tomcatOn Wed, Nov 4, 2009 at 10:34 AM, Glen Robson <glen.robson@...> wrote:
I'm trying to deploy cocoon to tomcat but I seem to be getting a conflict with the packaging type and maven. If I want the cocoon RCL plugin to run then the package type needs to be jar but if I want to deploy to tomcat the package type needs to be war (in the pom.xml). I can get the code working if I use jetty as it doesn't seem to require a war package. The results after running mvn package with the package type set to war: You need two modules: one for the block and one for the webapp (you will probably also want a third, parent module to build them all in one shot). Don't try to edit the block's and set it's packaging to a war. This simply won't work, as you've seen. if you have a look at the tutorials, pay particular attention to the last one on deployment.
Using the cocoon-maven-plugin and jetty:run is (as far as I can see) development time only. -Dom |
|
|
Re: Deploying Cocoon 2.2 to tomcatHi Dom,
On 4 Nov 2009, at 22:35, Dominic Mitchell wrote:
Thanks for your reply. I do have two block as you say one for the block and one for the webapp. The block packaging type is set to jar but its the webapp packaging type I'm confused with. I've been following the tutorial you mentioned and it works well for jetty but I can't get it to work with tomcat. Am I using the correct tomcat maven plugin? 63 <groupId>org.codehaus.mojo</groupId> 64 <artifactId>tomcat-maven-plugin</artifactId> 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. Thanks for your help Glen |
|
|
Re: Deploying Cocoon 2.2 to tomcatOn Thu, Nov 5, 2009 at 9:19 AM, Glen Robson <glen.robson@...> wrote:
The webapp should definitely be packaged as "war".
I have no idea how the tomcat maven plugin works, I'm afraid (though it does look like the right plugin). I just manually copy the war into an external tomcat when it's ready. i.e after running "mvn package" in the webapp module.
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.
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: http://github.com/happygiraffe/cocoon-sample
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.
-Dom |
|
|
Re: Deploying Cocoon 2.2 to tomcatHi Dom,
On 5 Nov 2009, at 10:01, Dominic Mitchell wrote:
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()]"> <servlet> <servlet-name>UploadXML</servlet-name> <display-name>Upload XML</display-name> <servlet-class>uk.org.llgc.offair.maintance.servlet.UploadXML</servlet-class> <init-param> <param-name>mrr_base_location</param-name> <param-value>/usr/local/offair/maintance/</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>UploadXML</servlet-name> <url-pattern>/offair_maintance/upload/*</url-pattern> </servlet-mapping> </xweb> 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: <dependency> <groupId>uk.org.llgc</groupId> <artifactId>offair_maintance</artifactId> <version>1.0-SNAPSHOT</version> </dependency> 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. Thanks Glen |
|
|
|
|
|
Re: Deploying Cocoon 2.2 to tomcatHi Dom,
Is writing code using Java Servlets and the SSF less the "cocoon way" than using flowscript or were you referring to the xweb use? I'm afraid I'm new to cocoon 2.2 but have used cocoon 2.1.1 for the last few years. Thanks for fixing the issue. Glen |
|
|
Re: Deploying Cocoon 2.2 to tomcatOn Fri, Nov 6, 2009 at 3:12 PM, Glen Robson <glen.robson@...> wrote:
Excellent news.
The most useful thing that I've found for exploring cocoon is the git mirror. If you run git clone git://git.apache.org/cocoon.git, you get a full cocoon source tree with history. Then you can do git grep to quickly search through it all. It's very handy.
I was referring to using cocoon technologies rather than the servlet stuff. Where Cocoon provides something of course. It can be difficult to get a feel for this sort of thing, but as a rule of thumb, I reckon you should start trying to solve any problem starting with FlowScript.
It took me a while to get used to 2.2 Although much of this was learning maven rather than cocoon, it has to be said. -Dom |
| Free embeddable forum powered by Nabble | Forum Help |