Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:37:02+00:00 2026-06-02T04:37:02+00:00

I’m having problems trying to get a Spring 3.1 Framework webapp using the Servlet

  • 0

I’m having problems trying to get a Spring 3.1 Framework webapp using the Servlet 3.0 programmatic way to register the servlet running using the Jetty maven plugin.

Here is my maven plugin definition (specifies an override webdefault.xml that has the default servlet mapping removed):

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.1.v20120215</version>
    <configuration>
      <systemProperties>
        <systemProperty>
          <name>DEBUG</name>
          <value>TRUE</value>
        </systemProperty>
      </systemProperties>
      <scanIntervalSeconds>0</scanIntervalSeconds>
      <webAppConfig>
        <defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
      </webAppConfig>
      <stopPort>9966</stopPort>
      <stopKey>foo</stopKey>
    </configuration>
  </plugin>

Here’s my cut-down webapp:

public class GcpWebApplicationInitializer implements WebApplicationInitializer {
    public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigWebApplicationContext root = 
          new AnnotationConfigWebApplicationContext();
        root.scan();
        servletContext.addListener(new ContextLoaderListener(root));
        ServletRegistration.Dynamic servlet = servletContext.addServlet("TESTSERVLET", new DispatcherServlet(root));
        servlet.setLoadOnStartup(1);
        servlet.addMapping("/");
    }
}

The commannd line I use to run this up is:

mvn -U clean package jetty:run-war

with the following output (just the run-war part):

[INFO] Configuring Jetty for project: GCP Jetty
[INFO] Context path = /
[INFO] Tmp directory = /Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/tmp
[INFO] Web defaults = src/main/resources/webdefault.xml
[INFO] Web overrides =  none
2012-03-16 17:09:25.668:INFO:oejs.Server:jetty-8.1.1.v20120215
2012-03-16 17:09:25.691:INFO:oejw.WebInfConfiguration:Extract    jar:file:/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT.war!/ to /Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT
2012-03-16 17:09:27.068:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2012-03-16 17:09:30.925:INFO:/:No Spring WebApplicationInitializer types detected on classpath
2012-03-16 17:09:31.186:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT/},/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:09:31.186:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT/},/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:09:31.186:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT/},/Users/srowatt/dev/svn/prototypes/gcp-jetty/trunk/target/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:09:31.233:INFO:oejs.AbstractConnector:Started    SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server

As you can see it detected the Spring servlet SpringServletContainerInitializer but that servlet didn’t detect the GcpWebApplicationInitializer. BUT if I take the war file and manually put it under a standalone Jetty it will detect the GcpWebApplicationInitializer.

Shanes-MacBook-Pro:bin srowatt$ ./jetty.sh  run
Running Jetty: 
2012-03-16 17:26:21.051:INFO::Redirecting stderr/stdout to /Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/logs/2012_03_16.stderrout.log
2012-03-16 17:26:21.353:INFO:oejs.Server:jetty-8.1.1.v20120215
2012-03-16 17:26:21.371:INFO:oejdp.ScanningAppProvider:Deployment monitor /Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps at interval 1
2012-03-16 17:26:21.379:INFO:oejd.DeploymentManager:Deployable added: /Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/cometd.war
2012-03-16 17:26:21.452:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/cometd.war!/ to /private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-cometd.war-_cometd-any-/webapp
2012-03-16 17:26:23.976:WARN:oejj.ObjectMBean:No mbean getter or setters found for maxCookieAge in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:23.976:WARN:oejj.ObjectMBean:No mbean getter or setters found for sessionPath in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:24.215:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/cometd,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-cometd.war-_cometd-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/cometd.war
2012-03-16 17:26:24.216:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/cometd,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-cometd.war-_cometd-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/cometd.war
2012-03-16 17:26:24.216:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/cometd,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-cometd.war-_cometd-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/cometd.war
2012-03-16 17:26:24.466:INFO:oejd.DeploymentManager:Deployable added: /Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root
2012-03-16 17:26:24.576:WARN:oejj.ObjectMBean:No mbean getter or setters found for maxCookieAge in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:24.576:WARN:oejj.ObjectMBean:No mbean getter or setters found for sessionPath in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:24.581:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root
2012-03-16 17:26:24.581:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root
2012-03-16 17:26:24.581:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/root
2012-03-16 17:26:24.583:INFO:oejd.DeploymentManager:Deployable added: /Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:26:24.602:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war!/ to /private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-gcp-jetty-0.0.1-SNAPSHOT.war-_gcp-jetty-0.0.1-SNAPSHOT-any-/webapp
2012-03-16 17:26:29.305:WARN:oejj.ObjectMBean:No mbean getter or setters found for maxCookieAge in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:29.305:WARN:oejj.ObjectMBean:No mbean getter or setters found for sessionPath in class org.eclipse.jetty.server.session.HashSessionManager
2012-03-16 17:26:29.314:INFO:g0.1-SNAPSHOT:Spring WebApplicationInitializers detected on classpath: [com.gcpgroup.jetty.GcpWebApplicationInitializer@11767553]
2012-03-16 17:26:30.362:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/gcp-jetty-0.0.1-SNAPSHOT,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-gcp-jetty-0.0.1-SNAPSHOT.war-_gcp-jetty-0.0.1-SNAPSHOT-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:26:30.363:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/gcp-jetty-0.0.1-SNAPSHOT,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-gcp-jetty-0.0.1-SNAPSHOT.war-_gcp-jetty-0.0.1-SNAPSHOT-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:26:30.363:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/gcp-jetty-0.0.1-SNAPSHOT,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-gcp-jetty-0.0.1-SNAPSHOT.war-_gcp-jetty-0.0.1-SNAPSHOT-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:26:30.363:INFO:g0.1-SNAPSHOT:Initializing Spring root WebApplicationContext
2012-03-16 17:26:30.495:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/gcp-jetty-0.0.1-SNAPSHOT,file:/private/var/folders/k3/bb7sgd616rdbwj9n0xl2k92m0000gq/T/jetty-0.0.0.0-8080-gcp-jetty-0.0.1-SNAPSHOT.war-_gcp-jetty-0.0.1-SNAPSHOT-any-/webapp/},/Users/srowatt/dev/tools/jetty-hightide-8.1.1.v20120215/webapps/gcp-jetty-0.0.1-SNAPSHOT.war
2012-03-16 17:26:30.498:INFO:g0.1-SNAPSHOT:Initializing Spring FrameworkServlet 'TESTSERVLET'

Also if I use
mvn -U clean package jetty:run
then it will also detect the GcpWebApplicationInitializer as it should.

So why is the jetty:run-war not behaving as I expect? Initially I thought it was the jetty plugin causing the issue but now I think it’s more of a Spring issue or classpath issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:37:04+00:00Added an answer on June 2, 2026 at 4:37 am

    We are using a similar setup with spring 3.1 & jetty 8. Our config is:

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <webApp>
                        <contextPath>/</contextPath>
                    </webApp>
                    <jettyConfig>src/main/resources/jetty.xml</jettyConfig>
                    <systemProperties>
                        <systemProperty>
                            <name>log4j.configuration</name>
                            <value>file://${project.basedir}/src/main/conf/target/generated-resources/log4j.xml</value>
                        </systemProperty>
                        <systemProperty>
                            <name>env</name>
                            <value>${env}</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>I_CANT_STAND_IT_ANYMORE</stopKey>
                    <stopPort>54124</stopPort>
                </configuration>
            </plugin>
    

    You need maven 3.x, with maven 2 you’ll end up with a jetty that is not servlet 3.0 compatible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.