cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominic Mitchell <...@happygiraffe.net>
Subject Re: problems with "Getting Started" 2.2 [was: Starting out with Cocoon 2.2]
Date Wed, 23 Sep 2009 07:22:48 GMT
On Tue, Sep 22, 2009 at 9:58 PM, Steven D. Majewski <sdm7g@virginia.edu>wrote:

> We've been using Cocoon 2.1.* for some time now, but we haven't really been
> doing a proper build.
> We've been building the sample app, and using that as a development base,
> adding new pipelines
> and sitemaps, and eventually, removing the samples directory before
> deploying.
>
> I've started to look at 2.2, thinking it made more sense to learn the 2.2
> build process
> with Maven that to continue on 2.1, but I'm having so many problems just
> getting the
> "getting started" to work, that I'm having second thoughts.
>

Getting a good handle on maven is very useful, and will pay off not just for
Cocoon apps, but also for any other Java projects where you need a good
build system.

I recommend checking out Sonatype's “definitive guide to maven”:
http://www.sonatype.com/books/maven-book/reference/

I've gotten as far as "Deploying a Cocoon application" :
>        <http://cocoon.apache.org/2.2/1362_1_1.html
>
> But I had to add a few extra maven steps to get that far.
>
>
>  I had to do a 'mvn package' on myBlock1 & myBlock2 to get the jars built,
>  so that later do 'mvn install:install-file ... -Dfile=... '  to manage
>  to get 'mvn jetty:run' to work without error.
>  Perhaps these differences from the documented steps are due to Mac OS 10.5
>  having a newer version of Maven installed:
>

Instead of "mvn package" you need to do "mvn install".  That will tale care
of installing everything to your local repository automatically.
 install:install-file is only needed for 3rd party things that aren't in a
repository.

In fact, I've just realised that using install:install-file is the root
cause of your problems below.  I'm guessing that you only installed the jar
files, not the pom files.  Because of that, maven doesn't know about the
dependencies of the block when you try to pull them together in the webapp.
 Which is why you get the ClassNotFoundException below.


> mvn --version
>
>
> Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
> Java version: 1.5.0_20
> Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.5.8" arch: "i386" Family: "unix"
>
>
> Now, I'm up to trying to join the 2 blocks in a webapp.
> After adding the block dependencies to my pom.xml, 'mvn jetty:run' gives
> this warning:
>
> Could not instantiate listener
> org.springframework.web.context.ContextLoaderListener
> java.lang.ClassNotFoundException:
> org.springframework.web.context.ContextLoaderListener
> [ ... stack trace ... ]
>
>
> Searching the mailing list archives, I see this error mentioned as a result
> if you
> DON'T add block dependencies to an empty webapp, but I have added these
> dependencies
> to pom.xml ( and I've 'mvn install' -ed  myBlock1 & myBlock2 )
>
>
>  <dependencies>
>
>        <dependency>
>                <groupId>edu.virginia.lib</groupId>
>                <artifactId>myBlock1</artifactId>
>                <version>1.0-SNAPSHOT</version>
>        </dependency>
>        <dependency>
>                <groupId>edu.virginia.lib</groupId>
>                <artifactId>myBlock2</artifactId>
>                <version>1.0-SNAPSHOT</version>
>        </dependency>
>
>  </dependencies>
>
>
>
> Any idea about what else I'm missing ?
>

My first question would have been: are the dependencies correct?  What
happens if you run mvn dependency:tree in the webapp?  It should include
spring dependencies.

If it helps, I completed the tutorials and put them in github.  So you can
take a look and see what worked for me.

  http://github.com/happygiraffe/cocoon-sample


> Is the cocoon 2.2 documentation all wrong ?
> Or are these differences due to changes in maven and it's defaults ?
>

-Dom

Mime
View raw message