Search
Calendar
July 2011
S M T W T F S
« Jun   Aug »
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Archives

Archive for July 15th, 2011

PostHeaderIcon Maven / Jetty 7 / java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener

Case

My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin was renamed as jetty-maven-plugin)

I get this error:

java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener

Quick Fix

In Jetty plugin, add a dependency to servlet-api, eg:

          <plugin>
              <groupId>org.mortbay.jetty</groupId>
              <artifactId>jetty-maven-plugin</artifactId>
              <version>7.4.4.v20110707</version>
              <dependencies>
                  <dependency>
                      <groupId>javax.servlet</groupId>
                      <artifactId>servlet-api</artifactId>
                      <version>2.4</version>
                  </dependency>
              </dependencies>

PostHeaderIcon Maven / Jetty / Cause: Class name which was explicitly given in configuration using ‘implementation’ attribute: ‘org.mortbay.jetty.bio.SocketConnector’ cannot be loaded

Case

My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin was renamed as jetty-maven-plugin)

I get this error:

 Cause: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.mortbay.jetty.bio.SocketConnector' cannot be loaded

Quick fix

org.mortbay.jetty.bio.SocketConnector was removed from Jetty with the release 7. To fix the issue, use a more recent implementation. For instance, replace this block:

<connector implementation="org.mortbay.jetty.bio.SocketConnector">

with that one:

<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">

PostHeaderIcon Maven / Jetty / Cannot override read-only parameter: contextPath in goal

Case

My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin was renamed as jetty-maven-plugin)

I get this error:

 Error configuring: org.mortbay.jetty:jetty-maven-plugin. Reason: ERROR: Cannot override read-only parameter: contextPath in goal: jetty:run-exploded

Quick fix

Insert a tag <webAppConfig> between <configuration> and <contextPath>. In other terms, replace this block:

<configuration>
    <contextPath>/I/love/USA</contextPath>
</configuration>

with that one:

<configuration>
    <webAppConfig>
        <contextPath>/I/love/USA</contextPath>
    </webAppConfig>
</configuration>

PostHeaderIcon Maven / Jetty / java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet

Case

I have a WAR containing Axis2-built on webservices. I must deploy it under Jetty 6. The version of Axis2 is 1.5.X.
I get this exception:

java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet

I assume the same case may occur with Tomcat.

Explanation

The class AxisAdminServlet was removed from Axis2 between the releases 1.4 and 1.5.

Quick fix

Add the following dependency in Maven’s Jetty plugin:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.26</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.4.1</version>
        </dependency>
    </dependencies>
(...)