Cargo Maven2 plugin: failure to deploy in Tomcat6x

View: New views
3 Messages — Rating Filter:   Alert me  

Cargo Maven2 plugin: failure to deploy in Tomcat6x

by greko23 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello guys,

I am using the cargo maven2 plugin to deploy a WAR in tomcat6x (6.0.18). I am getting the following error (it seems that there is a collission with the class loader), but I do not understand well why and how to fix it.

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/ServletContext"


I think it might be related to the fact that I have some dependencies on Tomact (catalina), however the scope is set as "provided" in my pom.xml. Also, from javax.servlet I have the following dependencies: jstl (runtime), servlet-api (provided) and jsp-api (provided). Any ideas on how can I get this working??

Note: Cargo+Tomcat6x works fine when I use it to deploy a more simple/empty WAR (basic maven project, basic pom). If I use the default Jetty container, then I can succesfully see the site but some pages won't work well due to the dependencies on Tomcat6.

Configuration in my pom.xml
=====================
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0</version>
        <configuration>
         
          <container>
            <containerId>tomcat6x</containerId>
           
            <zipUrlInstaller>
              <url>http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip</url>
              <installDir>${project.build.directory}/cargoinstalls</installDir>
            </zipUrlInstaller>
            <log>${project.build.directory}/tomcat6x/cargo.log</log>
          </container>
         
          <configuration>
            <home>${project.build.directory}/tomcat6x/config</home>
          </configuration>
          <wait>true</wait>
        </configuration>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>


Relevant logs
==========

[17:45:34.718][warn][talledLocalContainer] SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
[17:45:34.718][warn][talledLocalContainer] java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/ServletContext"
[17:45:34.718][warn][talledLocalContainer]  at java.lang.ClassLoader.defineClass1(Native Method)
[17:45:34.719][warn][talledLocalContainer]  at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
[17:45:34.719][warn][talledLocalContainer]  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
[17:45:34.719][warn][talledLocalContainer]  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
[17:45:34.719][warn][talledLocalContainer]  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:181)
[17:45:34.719][warn][talledLocalContainer]  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardService.start(StandardService.java:516)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
[17:45:34.719][warn][talledLocalContainer]  at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
[17:45:34.720][warn][talledLocalContainer]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:45:34.720][warn][talledLocalContainer]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[17:45:34.720][warn][talledLocalContainer]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[17:45:34.720][warn][talledLocalContainer]  at java.lang.reflect.Method.invoke(Method.java:597)
[17:45:34.720][warn][talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
[17:45:34.720][warn][talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Thanks,
Greko



Re: Cargo Maven2 plugin: failure to deploy in Tomcat6x

by Matt Wringe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-05-31 at 01:38 +0000, greko23@... wrote:

> Hello guys,
>
> I am using the cargo maven2 plugin to deploy a WAR in tomcat6x
> (6.0.18). I am getting the following error (it seems that there is a
> collission with the class loader), but I do not understand well why
> and how to fix it.
>
> java.lang.LinkageError: loader constraint violation: loader (instance
> of org/apache/catalina/loader/WebappClassLoader) previously initiated
> loading for a different type with name "javax/servlet/ServletContext"
>
> I think it might be related to the fact that I have some dependencies
> on Tomact (catalina), however the scope is set as "provided" in my
> pom.xml. Also, from javax.servlet I have the following dependencies:
> jstl (runtime), servlet-api (provided) and jsp-api (provided). Any
> ideas on how can I get this working??

Your dependencies shouldn't matter as Cargo usually requires the
dependencies to be specified again in the cargo plugin for them to take
effect against a server.

What happens if you manually start the server and deploy the war? does
the error still exist?

I have a feeling it might be because your war contains a jar that has a
the catalina classes in it. If that is the case then you need to look at
the maven war plugin to determine how to prevent those jars from being
loaded.

> Note: Cargo+Tomcat6x works fine when I use it to deploy a more
> simple/empty WAR (basic maven project, basic pom). If I use the
> default Jetty container, then I can succesfully see the site but some
> pages won't work well due to the dependencies on Tomcat6.
>
> Configuration in my pom.xml
> =====================
>       <plugin>
>         <groupId>org.codehaus.cargo</groupId>
>         <artifactId>cargo-maven2-plugin</artifactId>
>         <version>1.0</version>
>         <configuration>
>          
>           <container>
>             <containerId>tomcat6x</containerId>
>            
>             <zipUrlInstaller>
>
> <url>http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip</url>
>
> <installDir>${project.build.directory}/cargoinstalls</installDir>
>             </zipUrlInstaller>
>             <log>${project.build.directory}/tomcat6x/cargo.log</log>
>           </container>
>          
>           <configuration>
>             <home>${project.build.directory}/tomcat6x/config</home>
>           </configuration>
>           <wait>true</wait>
>         </configuration>
>         <executions>
>           <execution>
>             <id>start-container</id>
>             <phase>pre-integration-test</phase>
>             <goals>
>               <goal>start</goal>
>             </goals>
>           </execution>
>           <execution>
>             <id>stop-container</id>
>             <phase>post-integration-test</phase>
>             <goals>
>               <goal>stop</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
> Relevant logs
> ==========
>
> [17:45:34.718][warn][talledLocalContainer] SEVERE: Exception sending
> context initialized event to listener instance of class
> org.springframework.web.context.ContextLoaderListener
> [17:45:34.718][warn][talledLocalContainer] java.lang.LinkageError:
> loader constraint violation: loader (instance of
> org/apache/catalina/loader/WebappClassLoader) previously initiated
> loading for a different type with name "javax/servlet/ServletContext"
> [17:45:34.718][warn][talledLocalContainer]  at
> java.lang.ClassLoader.defineClass1(Native Method)
> [17:45:34.719][warn][talledLocalContainer]  at
> java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> [17:45:34.719][warn][talledLocalContainer]  at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> [17:45:34.719][warn][talledLocalContainer]  at
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:181)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardService.start(StandardService.java:516)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> [17:45:34.719][warn][talledLocalContainer]  at
> org.apache.catalina.startup.Catalina.start(Catalina.java:578)
> [17:45:34.720][warn][talledLocalContainer]  at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [17:45:34.720][warn][talledLocalContainer]  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [17:45:34.720][warn][talledLocalContainer]  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [17:45:34.720][warn][talledLocalContainer]  at
> java.lang.reflect.Method.invoke(Method.java:597)
> [17:45:34.720][warn][talledLocalContainer]  at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> [17:45:34.720][warn][talledLocalContainer]  at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>
> Thanks,
> Greko
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Parent Message unknown Re: Re: Cargo Maven2 plugin: failure to deploy in Tomcat6x

by greko23 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Actually there was no jar but javax/servlet classes exposed in the WAR (BTW that seems to be caused by a bug in maven). So I used the maven-war-plugin to exclude those (<packagingExcludes>WEB-INF/classes/javax/**</packagingExcludes>), as a workaround.

Thanks!


On jue 4/06/09 11:23 , Matt Wringe mwringe@... sent:
On Sun, 2009-05-31 at 01:38 +0000, javascript:top.opencompose('greko23@...','','','') wrote:

> Hello guys,

>

> I am using the cargo maven2 plugin to deploy a WAR in tomcat6x

> (6.0.18). I am getting the following error (it seems that there is a

> collission with the class loader), but I do not understand well why

> and how to fix it.

>

> java.lang.LinkageError: loader constraint violation: loader (instance

> of org/apache/catalina/loader/WebappClassLoader) previously initiated

> loading for a different type with name "javax/servlet/ServletContext"

>

> I think it might be related to the fact that I have some dependencies

> on Tomact (catalina), however the scope is set as "provided" in my

> pom.xml. Also, from javax.servlet I have the following dependencies:

> jstl (runtime), servlet-api (provided) and jsp-api (provided). Any

> ideas on how can I get this working??


Your dependencies shouldn't matter as Cargo usually requires the
dependencies to be specified again in the cargo plugin for them to take
effect against a server.

What happens if you manually start the server and deploy the war? does
the error still exist?

I have a feeling it might be because your war contains a jar that has a
the catalina classes in it. If that is the case then you need to look at
the maven war plugin to determine how to prevent those jars from being
loaded.


> Note: Cargo+Tomcat6x works fine when I use it to deploy a more

> simple/empty WAR (basic maven project, basic pom). If I use the

> default Jetty container, then I can succesfully see the site but some

> pages won't work well due to the dependencies on Tomcat6.

>

> Configuration in my pom.xml

> =====================

>

> org.codehaus.cargo

> cargo-maven2-plugin

> 1.0

>

>

>

> tomcat6x

>

>

>

>
http://correo.terra.com/71.1.1trr/parse.php?redirect=http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip

>

> ${project.build.directory}/cargoinstalls

>

> ${project.build.directory}/tomcat6x/cargo.log

>

>

>

> ${project.build.directory}/tomcat6x/config

>

> true

>

>

>

> start-container

> pre-integration-test

>

> start

>

>

>

> stop-container

> post-integration-test

>

> stop

>

>

>

>

>

>

> Relevant logs

> ==========

>

> [17:45:34.718][warn][talledLocalContainer] SEVERE: Exception sending

> context initialized event to listener instance of class

> org.springframework.web.context.ContextLoaderListener

> [17:45:34.718][warn][talledLocalContainer] java.lang.LinkageError:

> loader constraint violation: loader (instance of

> org/apache/catalina/loader/WebappClassLoader) previously initiated

> loading for a different type with name "javax/servlet/ServletContext"

> [17:45:34.718][warn][talledLocalContainer] at

> java.lang.ClassLoader.defineClass1(Native Method)

> [17:45:34.719][warn][talledLocalContainer] at

> java.lang.ClassLoader.defineClass(ClassLoader.java:621)

> [17:45:34.719][warn][talledLocalContainer] at

> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)

> [17:45:34.719][warn][talledLocalContainer] at

> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

> [17:45:34.719][warn][talledLocalContainer] at

> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:181)

> [17:45:34.719][warn][talledLocalContainer] at

> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardService.start(StandardService.java:516)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

> [17:45:34.719][warn][talledLocalContainer] at

> org.apache.catalina.startup.Catalina.start(Catalina.java:578)

> [17:45:34.720][warn][talledLocalContainer] at

> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

> [17:45:34.720][warn][talledLocalContainer] at

> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

> [17:45:34.720][warn][talledLocalContainer] at

> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

> [17:45:34.720][warn][talledLocalContainer] at

> java.lang.reflect.Method.invoke(Method.java:597)

> [17:45:34.720][warn][talledLocalContainer] at

> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

> [17:45:34.720][warn][talledLocalContainer] at

> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

>

> Thanks,

> Greko

>

>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email



Eaje verificado por el Antispam Terra.