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 8886597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:35:48+00:00 2026-06-14T21:35:48+00:00

My goal is to set up a jetty test server and inject a custom

  • 0

My goal is to set up a jetty test server and inject a custom servlet to test some REST classes in my project. I was able to launch the server with spring xml and run tests against that server. The issue I’m having is sometimes after the server started, the process stopped at the point before running the tests. It seems jetty didn’t go to background. It works every time on my computer. But when I deployed to my CI server, it doesn’t work. It also doesn’t work when I’m on VPN. (Strange.)

The server should be completed initialized as when the tests stuck, I was able to access the server using a browser.

Here is my spring context xml:

….

<bean id="servletHolder" class="org.eclipse.jetty.servlet.ServletHolder">
    <constructor-arg ref="courseApiServlet"/>
</bean>

<bean id="servletHandler" class="org.eclipse.jetty.servlet.ServletContextHandler"/>

<!-- Adding the servlet holders to the handlers -->
<bean id="servletHandlerSetter" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject" ref="servletHandler"/>
    <property name="targetMethod" value="addServlet"/>
    <property name="arguments">
        <list>
            <ref bean="servletHolder"/>
            <value>/*</value>
        </list>
    </property>
</bean>

<bean id="httpTestServer" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop" depends-on="servletHandlerSetter">
    <property name="connectors">
        <list>
            <bean class="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <property name="port" value="#{settings['webservice.server.port']}" />
            </bean>

        </list>
    </property>

    <property name="handler">
        <ref bean="servletHandler" />
    </property>
</bean>

Running latest Jetty 8.1.8 server and Spring 3.1.3. Any idea?

  • 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-14T21:35:49+00:00Added an answer on June 14, 2026 at 9:35 pm

    I figured it out. My bad. The IP address for the testing web server (jetty) that my REST client connect to is set to a internal IP address (not localhost) that only available to my local host. So that why the tests couldn’t start when I’m on VPN or on CI server.

    The xml is actually working and I think it is better than starting jetty in separate ant task. Because spring manage the jetty lifecycle. When the tests finish, spring will shutdown jetty automatically.

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

Sidebar

Related Questions

Consider an ASP.NET MVC 2 project with VS 2010. The goal is to set
In Google Analytics I set a Goal that is a simple URL Destination using
The goal would be to set the profile the same way as in a
I have the pages that I want to set as a goal in Google
I'm trying to set up integration tests using the AbstractTransactionalJUnit4SpringContextTests base class. My goal
My goal is to set the focus to a specific inputText. As there seems
My goal is to set virtual memory page permissions (as if the forked process
Hi guys I'm trying to set the width of an EditText. My goal is
GOAL: Declare/set variables in the scope of the function that called the running function.
My goal is to set the users notification sound from a file that is

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.