On 10/09/2012 20:30, Thorsten Scherler wrote:
[...]
This breaks jetty:run and I am ATM not sure why. It fails like:

20:11:38.723 [main] ERROR o.s.web.context.ContextLoader - Context initialization failed
java.lang.NoClassDefFoundError: org/springframework/core/env/Environment
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.7.0_02-ea] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) ~[na:1.7.0_02-ea]
    at java.lang.Class.getConstructor0(Class.java:2714) ~[na:1.7.0_02-ea]
at java.lang.Class.getDeclaredConstructor(Class.java:2002) ~[na:1.7.0_02-ea] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:61) ~[spring-beans-2.5.1.jar:2.5.1] at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:249) ~[spring-web-2.5.1.jar:2.5.1] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) ~[spring-web-2.5.1.jar:2.5.1] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) [spring-web-2.5.1.jar:2.5.1] at org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener.invoke(ReloadingListener.java:265) [cocoon-rcl-webapp-wrapper-1.0.2.jar:1.0.2] at org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener.contextInitialized(ReloadingListener.java:150) [cocoon-rcl-webapp-wrapper-1.0.2.jar:1.0.2] at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548) [jetty-6.1.25.jar:6.1.25

You can reproduce it as follows.

cd src/apache/cocoon2.2/
svn up
mvn clean install
mkdir tmp
mvn archetype:generate -DarchetypeGroupId=org.apache.cocoon -DarchetypeArtifactId=cocoon-22-archetype-block -DarchetypeVersion=1.1.0-SNAPSHOT -DgroupId=my.groupid -DartifactId=2233 -DarchetypeRepository=local
cd 2233
# make sure that the pom has
 <dependency>
      <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-core</artifactId>
       <version>2.2.1-SNAPSHOT</version>
    </dependency>
mvn clean install jetty:run

then you will get above error in the console. :(

any idea why there is requested a class which is in spring 3.1 (which is not declared as dep) but cannot be found in the 2.5.x what we are using in 2.2.

Further I tested before I committed and there it was working (at least I think it did).

Anyway I tested now on another box to make sure and it is failing as described above.

Any ideas very welcome!

Hi Thorsten,
this is happening because the generated project is using the latest version of the cocoon-maven-plugin (1.0.2) which in turn is enforcing the latest versions of cocoon-rcl-webapp-wrapper (1.0.2) and cocoon-rcl-spring-reloader (1.0.2); these are in turn dependent on Spring 3.1.

Following the procedure reported above, I've changed (in the generated pom.xml):

<plugin>
        <groupId>org.apache.cocoon</groupId>
        <artifactId>cocoon-maven-plugin</artifactId>
        <version>1.0.2</version>
        <executions>
          <execution>
            <id>prepare</id>
            <phase>compile</phase>
            <goals>
              <goal>prepare</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

into

<plugin>
        <groupId>org.apache.cocoon</groupId>
        <artifactId>cocoon-maven-plugin</artifactId>
        <version>1.0.0</version>
<dependencies>
    <!-- RCL -->
    <dependency>
      <groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-rcl-spring-reloader</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cocoon</groupId>
      <artifactId>cocoon-rcl-webapp-wrapper</artifactId>
      <version>1.0.0</version>
    </dependency>
</dependencies>
        <executions>
          <execution>
            <id>prepare</id>
            <phase>compile</phase>
            <goals>
              <goal>prepare</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

and now it works.

I'd suggest to make this changes to archetype resources's pom.xml.

Moreover, consider that when issuing 'mvn clean deploy' instead of 'mvn clean install', you will also upload the SNAPSHOT artifacts to ASF maven repository (Nexus): since 2.2.X does not have a configured Jenkins instance for this (like as C3), you still need to do this manually when you want to publish updated SNAPSHOT artifacts.

Regards.

--
Francesco Chicchiriccò

ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/

Reply via email to