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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:36:02+00:00 2026-06-03T05:36:02+00:00

This is a similar question to those that have been asked before, but still

  • 0

This is a similar question to those that have been asked before, but still different, and I simply can’t figure it out.

I have a controller for a REST webservice implemented with MVC which should be handling requests for the path ‘/users/contacts’, the problem is that in my client test app, when I try to hit that path I get:

No mapping found for HTTP request with URI /users/users/contacts in DispatcherServlet with name 'webservice'

Again, in my client test app, when I change the request path to something like ‘/WHATEVERusers/contacts’, I’ll get an error that it can’t resolve ‘/WHATEVERusers/contacts’

I don’t know why when I try to hit a path handled by a controller it get’s mangled, but when I request some garbage path, it doesn’t.

I don’t have the code in front of me, but will be able to answer questions when I get home.

Here’s code from my test client:

private static void TestGetContacts()
{
    UserCreateRequest request = new UserCreateRequest();

    Gson gson = new Gson();

    try

    {
        HttpClient client = new DefaultHttpClient();

        StringEntity string  = new StringEntity(gson.toJson(request), HTTP.UTF_8);
        string.setContentType("application/json");

        URI uri = URIUtils.createURI("http", "localhost", 8888, "/users/contacts", null, null);

        HttpPost post = new HttpPost(uri);
        post.setEntity(string);

        client.execute(post);
    }
    catch(Exception ex)
    {
        System.out.println(ex.getMessage());
    }
}

Here’s my controller class:

@Controller
@RequestMapping("/users/contacts")
public class UserContactService
{
private @Autowired ApplicationContext appContext;

@RequestMapping(method=RequestMethod.POST, consumes="application/json", produces="application/json")
public GetContactsResponse GetContacts(@RequestBody UserCreateRequest request)
{
    GetContactsResponse response = new GetContactsResponse();

    return response;
}
}

Here’s my servlet config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
    xmlns:oxm="http://www.springframework.org/schema/oxm"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">

<!--
    - The controllers are autodetected POJOs labeled with the @Controller annotation.
-->
<context:component-scan base-package="com.impersonal.server.restservice.users"/>                

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="messageConverters">
        <list>
            <ref bean="jsonConverter" />
            <!-- 
            <ref bean="marshallingConverter" />
            <ref bean="atomConverter" />
            -->
        </list>
    </property>
</bean>

<bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
    <property name="supportedMediaTypes" value="application/json" />
</bean>

And here’s my web config:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/**/applicationContext.xml</param-value>
</context-param>

<servlet>
    <servlet-name>webservice</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>webservice</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

Update:
My requests are handled in my controller, but after the request is handled, the server prints out that it couldn’t resolve /users/users/contacts. For some reason another request is getting to DispsatcherServlet, and I don’t know why..

Thanks,
Mark

  • 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-03T05:36:03+00:00Added an answer on June 3, 2026 at 5:36 am

    Adding @ResponseBody to my method signature solved my issue. Didn’t realize I actually needed it, and not having it resulted in really odd side affects.

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

Sidebar

Related Questions

I know that similar questions to this have been asked before but after doing
I am aware that similar questions to this have been asked, but I have
it is possible that similar questions have been asked earlier, but I can't find
This is similar to a question that has already been asked. However, I am
Apologies if this question has been asked before, I couldn't find anything similar. I
I have asked a similar question before here , but after much thought, and
Sorry if this has been asked before - there's a question with a similar
I have asked this question before and attempted to solve it multiple time but
I have checked this similar question, but the suggestions did not solve my problem:
Similar questions have been asked over and over but for some reason none of

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.