« Return to Thread: Issues with Maven 2, Cargo and Jetty

Re: Issues with Maven 2, Cargo and Jetty

by Matt Raible-3 :: Rate this Message:

Reply to Author | View in Thread

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

 « Return to Thread: Issues with Maven 2, Cargo and Jetty