Issues with Maven 2, Cargo and Jetty

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

Issues with Maven 2, Cargo and Jetty

by Matt Raible-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm able to run "mvn jetty:run-war" just fine in my project.  However, when I try to use Cargo with Jetty, I get the following error:

:WARN:  failed ContextHandler@627d08{/mywebapp,file:/private/tmp/Jetty__mywebapp/webapp/}
:INFO:  Extract jar:file:/private/tmp/cargo/conf/cargocpc.war!/ to /tmp/Jetty__cargocpc/webapp
:INFO:  Started SelectChannelConnector @ 0.0.0.0:8888
:WARN:  failed Server@171151
Exception in thread "Thread-1" org.codehaus.cargo.container.ContainerException: Failed to start the Jetty container
        at org.codehaus.cargo.container.jetty.internal.JettyExecutorThread.run(JettyExecutorThread.java :102)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.cargo.container.jetty.internal.JettyExecutorThread.run (JettyExecutorThread.java:68)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of ' org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log ' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of ' org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log ' visible, which is not allowed.))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java :235)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
        at org.apache.jasper.servlet.JspServlet .<init>(JspServlet.java:58)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0 (Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:118)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java :231)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:37)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:563)
        at org.mortbay.jetty.webapp.WebAppContext.startContext (WebAppContext.java:962)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:341)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:368)
        at org.mortbay.component.AbstractLifeCycle.start (AbstractLifeCycle.java:37)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:133)
        at org.mortbay.jetty.Server.doStart(Server.java:246)
        at org.mortbay.component.AbstractLifeCycle.start (AbstractLifeCycle.java:37)
        ... 5 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of ' org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log ' visible, which is not allowed.)

Here's my profile that enables Cargo + Jetty:

<profiles>
        <profile>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <wait>${cargo.wait}</wait>
                            <container>
                                <containerId>jetty6x</containerId>
                                <type>embedded</type>
                            </container>
                            <configuration>
                                <properties>
                                    <cargo.hostname>${cargo.host}</cargo.hostname>
                                    <cargo.servlet.port>${cargo.port}</cargo.servlet.port>
                                </properties>
                            </configuration>
                        </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>
                </plugins>
            </build>
        </profile>
    </profiles>

Any ideas?

Thanks,

Matt

--
http://raibledesigns.com

Re: Issues with Maven 2, Cargo and Jetty

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Now I'm getting a new error - does the Jetty embedded container need additional dependencies defined?

javax.servlet.UnavailableException: Could not instantiate class org.apache.jasper.servlet.JspServlet

        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:402)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:878)
        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:350)

Matt Raible-3 wrote:
I'm able to run "mvn jetty:run-war" just fine in my project.  However, when
I try to use Cargo with Jetty, I get the following error:

:WARN:  failed ContextHandler@627d08{
/mywebapp,file:/private/tmp/Jetty__mywebapp/webapp/}
:INFO:  Extract jar:file:/private/tmp/cargo/conf/cargocpc.war!/ to
/tmp/Jetty__cargocpc/webapp
:INFO:  Started SelectChannelConnector @ 0.0.0.0:8888
:WARN:  failed Server@171151
Exception in thread "Thread-1"
org.codehaus.cargo.container.ContainerException: Failed to start the Jetty
container
        at
org.codehaus.cargo.container.jetty.internal.JettyExecutorThread.run(
JettyExecutorThread.java:102)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.codehaus.cargo.container.jetty.internal.JettyExecutorThread.run(
JettyExecutorThread.java:68)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed. (Caused by
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed. (Caused by
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed.))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:235)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:209)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
        at org.apache.jasper.servlet.JspServlet.<init>(JspServlet.java:58)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:118)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(
ServletHolder.java:231)
        at org.mortbay.component.AbstractLifeCycle.start(
AbstractLifeCycle.java:37)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(
ServletHandler.java:563)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(
WebAppContext.java:962)
        at org.mortbay.jetty.handler.ContextHandler.doStart(
ContextHandler.java:341)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java
:368)
        at org.mortbay.component.AbstractLifeCycle.start(
AbstractLifeCycle.java:37)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(
HandlerCollection.java:133)
        at org.mortbay.jetty.Server.doStart(Server.java:246)
        at org.mortbay.component.AbstractLifeCycle.start(
AbstractLifeCycle.java:37)
        ... 5 more
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed. (Caused by
org.apache.commons.logging.LogConfigurationException: Invalid class loader
hierarchy.  You have more than one version of '
org.apache.commons.logging.Log' visible, which is not allowed.)

Here's my profile that enables Cargo + Jetty:

<profiles>
        <profile>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <wait>${cargo.wait}</wait>
                            <container>
                                <containerId>jetty6x</containerId>
                                <type>embedded</type>
                            </container>
                            <configuration>
                                <properties>
                                    <cargo.hostname>${cargo.host
}</cargo.hostname>
                                    <cargo.servlet.port>${cargo.port
}</cargo.servlet.port>
                                </properties>
                            </configuration>
                        </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>
                </plugins>
            </build>
        </profile>
    </profiles>

Any ideas?

Thanks,

Matt

--
http://raibledesigns.com

Re: Issues with Maven 2, Cargo and Jetty

by Jeroen Verhagen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matt,

Jan Bartel gave a pretty elaborate explaination to Jetty dependencies in answer to a question of me in this forum a few days ago. Maybe it's also usefull for you:

Jan Bartel wrote:
Jetty in cargo at the moment is an embedded container, that is, the
jetty classes have to be on the classpath at runtime. So, you can't
use the installer to install a version of jetty and then invoke a
container on it.

See http://cargo.codehaus.org/Jetty+6.x for hints.

As for the jetty jars, I recommend using 6.1.0rc2 (freshly baked!).
You'll need to put these jars as a minimum onto your runtime classpath:
 jetty.jar
 jetty-util.jar
 servlet-api-2.5.jar

then if you want to use jsps, you've got a choice of jsp-2.0 or
jsp-2.1. Use the former if you're using <jdk1.5, use the latter
if you're on jdk1.5 or above (I highly recommend jsp-2.1 if possible).
If using jsp-2.0, that uses commons logging, so you'll also need to
add some kind of commons logging impl. With the jetty distro, we
use the slf4j logging system to bridge to commons logging, to
overcome the horrendous classloading issues associated with
commons logging discovery mechanism. So, you can use the
jcl104-over-slf4j.jar to bridge commons logging to slf4j
and then use the slf4j-simple.jar as the actual log. Note
that the slf4j-simple will only output INFO level and above
messages, but you can use any of the other slf4j impls as you
like instead (eg an slf4j impl for log4j). See www.slf4j.org
for more info.

jsp-2.0 jars:
  ant-1.6.5.jar
  commons-el-1.0.jar
  jasper-compiler-5.5.15.jar
  jasper-compiler-jdt-5.5.15.jar
  jasper-runtime-5.5.15.jar
  jsp-api-2.0.jar
  jcl104-over-slf4j.jar and slf4j-simple.jar (optionals)

for jsp-2.1 jars:
  ant-1.6.5.jar
  core-3.1.1.jar
  jsp-api-2.1.jar
  jsp-2.1.jar
I solved my JSP issues with Jetty by adding this dependency:

    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jsp-2.1</artifactId>
      <version>6.1.0rc1</version>
      <scope>test</scope>
    </dependency>


Btw, I got Jetty to run as part of my JUnit TestSetup. This has the advantage, I think,  that Jetty is also started up when you run the test in your IDE of choose. If you're interested I could post the code.

regards,

Jeroen

mraible wrote:
Now I'm getting a new error - does the Jetty embedded container need additional dependencies defined?

javax.servlet.UnavailableException: Could not instantiate class org.apache.jasper.servlet.JspServlet

        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:402)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:878)
        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:350)

Re: Issues with Maven 2, Cargo and Jetty

by Matt Raible-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 12/19/06, Jeroen Verhagen <jeroenverhagen@...> wrote:

>
> Hi Matt,
>
> Jan Bartel gave a pretty elaborate explaination to Jetty dependencies in
> answer to a question of me in this forum a few days ago. Maybe it's also
> usefull for you:
>
>
> Jan Bartel wrote:
> >
> > Jetty in cargo at the moment is an embedded container, that is, the
> > jetty classes have to be on the classpath at runtime. So, you can't
> > use the installer to install a version of jetty and then invoke a
> > container on it.
> >
> > See http://cargo.codehaus.org/Jetty+6.x for hints.
> >
> > As for the jetty jars, I recommend using 6.1.0rc2 (freshly baked!).
> > You'll need to put these jars as a minimum onto your runtime classpath:
> >  jetty.jar
> >  jetty-util.jar
> >  servlet-api-2.5.jar
> >
> > then if you want to use jsps, you've got a choice of jsp-2.0 or
> > jsp-2.1. Use the former if you're using <jdk1.5, use the latter
> > if you're on jdk1.5 or above (I highly recommend jsp-2.1 if possible).
> > If using jsp-2.0, that uses commons logging, so you'll also need to
> > add some kind of commons logging impl. With the jetty distro, we
> > use the slf4j logging system to bridge to commons logging, to
> > overcome the horrendous classloading issues associated with
> > commons logging discovery mechanism. So, you can use the
> > jcl104-over-slf4j.jar to bridge commons logging to slf4j
> > and then use the slf4j-simple.jar as the actual log. Note
> > that the slf4j-simple will only output INFO level and above
> > messages, but you can use any of the other slf4j impls as you
> > like instead (eg an slf4j impl for log4j). See www.slf4j.org
> > for more info.
> >
> > jsp-2.0 jars:
> >   ant-1.6.5.jar
> >   commons-el-1.0.jar
> >   jasper-compiler-5.5.15.jar
> >   jasper-compiler-jdt-5.5.15.jar
> >   jasper-runtime-5.5.15.jar
> >   jsp-api-2.0.jar
> >   jcl104-over-slf4j.jar and slf4j-simple.jar (optionals)
> >
> > for jsp-2.1 jars:
> >   ant-1.6.5.jar
> >   core-3.1.1.jar
> >   jsp-api-2.1.jar
> >   jsp-2.1.jar
> >
> >
>
> I solved my JSP issues with Jetty by adding this dependency:
>
>     <dependency>
>       <groupId>org.mortbay.jetty</groupId>
>       <artifactId>jsp-2.1</artifactId>
>       <version>6.1.0rc1</version>
>       <scope>test</scope>
>     </dependency>

I tried changing my Jetty profile to:

        <profile>
            <id>jetty</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <wait>false</wait>
                            <container>
                                <containerId>jetty6x</containerId>
                                <type>embedded</type>
                            </container>
                            <configuration>
                                <properties>

<cargo.hostname>${cargo.host}</cargo.hostname>

<cargo.servlet.port>${cargo.port}</cargo.servlet.port>
                                </properties>
                            </configuration>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.mortbay.jetty</groupId>
                                <artifactId>jsp-2.1</artifactId>
                                <version>6.1.0rc1</version>
                                <scope>test</scope>
                            </dependency>
                        </dependencies>
                        <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>
                </plugins>
            </build>
        </profile>
    </profiles>

But I still get the same error:

javax.servlet.UnavailableException: Could not instantiate class
org.apache.jasper.servlet.JspServlet
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:402)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:878)

I also still get the log4j issues that've been discussed on this list
previously.

Caused by: org.apache.commons.logging.LogConfigurationException:
Invalid class loader hierarchy.  You have more than one version of
'org.apache.commons.logging.Log' visible, which is not allowed.
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
        ... 27 more
[INFO] [beddedLocalContainer] Jetty 6.x Embedded started on port [9876]

Matt

>
>
> Btw, I got Jetty to run as part of my JUnit TestSetup. This has the
> advantage, I think,  that Jetty is also started up when you run the test in
> your IDE of choose. If you're interested I could post the code.
>
> regards,
>
> Jeroen
>
>
> mraible wrote:
> >
> > Now I'm getting a new error - does the Jetty embedded container need
> > additional dependencies defined?
> >
> > javax.servlet.UnavailableException: Could not instantiate class
> > org.apache.jasper.servlet.JspServlet
> >
> >         at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:402)
> >         at
> > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:878)
> >         at
> > org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:350)
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Issues-with-Maven-2%2C-Cargo-and-Jetty-tf2661661.html#a7943420
> Sent from the Cargo - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
http://raibledesigns.com

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

    http://xircles.codehaus.org/manage_email