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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:42:24+00:00 2026-05-13T08:42:24+00:00

So I am writing a Spring(2.5( + Jersey(1.1.4.1) and trying to create a JSONConfiguration

  • 0

So I am writing a Spring(2.5( + Jersey(1.1.4.1) and trying to create a JSONConfiguration using a ContextResolver. Here is the code:

package com.rhigdon.jersey.config;

import com.sun.jersey.api.json.JSONConfiguration;
import com.sun.jersey.api.json.JSONJAXBContext;

import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import javax.xml.bind.JAXBContext;

@Provider
public final class JAXBContextResolver implements ContextResolver<JAXBContext> {
  private JAXBContext context;

  public JAXBContextResolver() throws Exception {
    this.context = new JSONJAXBContext(JSONConfiguration.mappedJettison().build(), "com.rhigdon.core.model.");
  }

  public JAXBContext getContext(Class<?> aClass) {
    return context;
  }
}

Unfortunately my app is still returning the default mapping:

{“id”:”1″,”question”:”What is/was the
name of your first pet?”}

When I debug the application it never actually hits this code. Is this due to using the SpringServlet? Here is my Jersey Config in my web.xml:

<servlet>
    <servlet-name>Jersey Spring Web Application</servlet-name>
    <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Jersey Spring Web Application</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

Anyone have a similar setup with JSONConfiguration working?

  • 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-05-13T08:42:25+00:00Added an answer on May 13, 2026 at 8:42 am

    You need to register your provider in your spring context:

    <bean class="com.company.jersey.config.JAXBContextResolver"/>
    

    Or, if you are using annotation-based configuration, you need to annotate your provider class with @Component and include something like

    <context:annotation-config />
    <context:component-scan base-package="com.company.jersey" />
    

    to your application context configuration.

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

Sidebar

Related Questions

I have writing Java code Using Jersey library to call Rest APIs. For my
I am writing simple CRUD(Create, Remove ,Update ,Delete) application using Spring MVC and hibernate.
I am working through the tutorials on writing custom spring namespace handlers found here:
I'm writing some simple DAOs in Java using JDBC (no Spring, Hibernate or anything
I am using Spring Framework . While writing custom queries, I am unable check
I am writing unit tests for service layer in my spring application. Here is
I am writing a Java EE application using Struts and Spring. In one of
i am writing following code in my project with spring framework 3 <c:set var=s
I am writing a Spring Restful webservices application using Spring MVC. I have used
I'm writing very basic schema-based Spring AOP, here's the .xml <bean id=aoplistener class=tao.zhang.Listener/> <aop:config>

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.