13

Hi i have the following configuration.

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.3.v20120416</version>
</plugin>

and in my jetty-env.xml I have

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
</Configure>

When i run with mvn jetty:run i get the following error.

Caused by: java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppCont
ext
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.eclipse.jetty.util.Loader.loadClass(Loader.java:92)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClas
s(XmlConfiguration.java:349)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
e(XmlConfiguration.java:314)
        at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.jav
a:279)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.applyJettyXml(AbstractJett
yMojo.java:449)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMo
jo.java:467)

How do i fix this?

Chun ping Wang
  • 3,879
  • 12
  • 42
  • 53

1 Answers1

21

I suspect you have a jetty-web.xml or some old jetty configuration files floating around

org.mortbay.jetty.webapp.WebAppContext = org.eclipse.jetty.webapp.WebAppContext

the packaging is different in jetty7 and 8 since we moved to the eclipse foundation a few years ago.

http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
jesse mcconnell
  • 7,102
  • 1
  • 22
  • 33
  • Thanks but now I get this exception Caused by: java.lang.IllegalArgumentException: Object of class 'org.mortbay.jett y.plugin.JettyServer' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. – Chun ping Wang May 09 '12 at 13:52
  • assuming that space in 'jett y' above is an error in just your comment, what file are you processing here? is it a jetty-web.xml in your WEB-INF directory, an old context.xml file or something else? – jesse mcconnell May 09 '12 at 14:35
  • their is no jetty-web.xml just plain web.xml like fro tomcat. – Chun ping Wang May 10 '12 at 03:23
  • 6
    Hi found the problem. I change to and things work – Chun ping Wang May 12 '12 at 06:22