Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] First experiences using Jetty for unittest

Thanks! That solved indeed the single dependency, but when I start the server I still get:

java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

It is a Maven project and compiles and runs correctly and does not have a "juli" jar. All that was added was:

    @BeforeClass
    static public void beforeClass()
    throws Exception
    {
        // start jetty
        iServer = new Server(8080);
        WebAppContext lWebAppContext = new WebAppContext();
        lWebAppContext.setContextPath("/CheyenneServlet");
        lWebAppContext.setWar("WebContent"); // jsps, static files, etc
lWebAppContext.setExtraClasspath("target/lib"); // Maven generates a lib directory with all jars lWebAppContext.addServlet(new ServletHolder(new CheyenneServlet()),"/cheyenne");
        iServer.setHandler(lWebAppContext);
        iServer.start();
    }

So this missing class must be caused by the code above.



On 2010-07-16 15:30, Jesse McConnell wrote:
Jetty 7 has aggregates where are a single dependency for all of the
bits and pieces you might need..you must have just missed it.

if there is a particular bundle that you need rolled then open an
issue for it and we'll see about added one...for example I am not sure
if we have the jsp aggregate bundle yet which it seems like you might
need.

http://repo2.maven.org/maven2/org/eclipse/jetty/aggregate/

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx



On Fri, Jul 16, 2010 at 08:22, Tom<tbee@xxxxxxxx>  wrote:
I have a number of unittest of a servlet running against Tomcat. This is not
practical because it requires Tomcat to be started (manually) before the
unittest can run. Since I'm also using Maven, so I'd like to start the
webapp container as part of the unittest, so I figured I'd give Jetty a try.

Initially I googled Jetty 6 and added the corresponding dependency to my
pom, and it downloaded fine. But then during the browsing of the
documentation I saw that there is a Jetty 7 hosted by Eclipse. So I wanted
to change my dependency to match that. But is seems there is no single
pom-artifact that just adds a full installation of Jetty 7. Very
unpractical! For unittesting it is not required to have a lean Jetty, just
roll it in.

I worked around that by adding the embedded-test artifact as a dependency.
And started to setup Jetty; that was quite simple and I quickly had a server
that should be able to start my webapp. Great! But then JAR hell broke lose.
Everytime I started the server I needed another JAR; initially the JSP
implementation was missing. So I copied the dependencies from the
embedded-test directly into my pom and tried adding the JSP component. After
that was ok, I got a missing Apache Juli, com.sun.org.apache.commons.Log,
and I stopped at: java.lang.NoSuchMethodError:
org.apache.xerces.xni.Augmentations.removeAllItems()

So I switched back to Jetty 6, which was a nice and single dependency. But I
ran into the same missing third party jars. Further investigation is needed
to determine why all these problems occur (remember that the project is
compiling and working fine ATM under Tomcat). I'll try again in another
project someday, but this was a frustrating ride so far.

If anyone can give pointers on what I may have done wrong, please do!

Tom
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users





Back to the top