Breaking News
Home / ServerSide / java.lang.NoClassDefFoundError: com/google/common/base/Function : Jetty Server fails to start

java.lang.NoClassDefFoundError: com/google/common/base/Function : Jetty Server fails to start

Exception

Jetty server fails to start and throws the following Exception:

584 [main] WARN org.mortbay.log – failed HandlerCollection@1fff293: java.lang.NoClassDefFoundError: com/google/common/base/Function584 [main] ERROR org.mortbay.log – Error starting handlers

java.lang.NoClassDefFoundError: com/google/common/base/Function

     at org.glassfish.jersey.servlet.WebComponent.createResourceConfig(WebComponent.java:403)

     at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:275)

     at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)

     at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)

     at javax.servlet.GenericServlet.init(GenericServlet.java:241)

     at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)

     at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)

     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

     at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:736)

     at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

     at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)

     at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)

     at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)

     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

     at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)

     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

     at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

     at org.mortbay.jetty.Server.doStart(Server.java:224)

     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

     at com.pix.service.Startup.main(Startup.java:81)

Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function

Solution

Make sure you have the Guava Libraries from Google in you classpath. There are required by the Jetty Web Server.

The Guava project contains several of Google’s core libraries that we
rely on in our Java-based projects: collections, caching, primitives
support, concurrency libraries, common annotations, string processing,
I/O, and so forth.

These libraries can be downloaded from:

http://code.google.com/p/guava-libraries/<!>

[pb_builder]

Check Also

How does a typical Log4j configuration looks like?

Answer Log4J is a very popular and commonly used logging implementation that is used in …

Advertisment ad adsense adlogger