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

  • Home
  • SEARCH
  • 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 3793666
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:48:38+00:00 2026-05-19T12:48:38+00:00

I’m trying to follow this tutorial and build a RESTful service that can un/marshal

  • 0

I’m trying to follow this tutorial and build a RESTful service that can un/marshal an object to/from XML.
http://www.stupidjavatricks.com/?p=54

The marshaller of choice in the article is xStream (I found it to be very easy to use and configure).

The point is, using STS — Spring’s own flavor of Eclipse bundled with tcServer — I built a project based on the STS template of MVC. This is a legacy project started from Spring version 2.4, and I migrated it to version 3.0. So, the template created all the necessary XML markup, and I added my configuration to point the view to the correct object conversion (to the xstream marshaler).

Here is part of my bean that sends the object to a new view (copied out from the link):

<bean id="bookXmlView" class="org.springframework.web.servlet.view.xml.MarshallingView">  
     <constructor-arg>  
         <bean class="org.springframework.oxm.xstream.XStreamMarshaller">  
             <property name="autodetectAnnotations" value="true"/>  
         </bean>  
     </constructor-arg>  
</bean>

It all worked nicely until I installed the latest STS version 2.5.2.RELEASE and created a new MVC project from a template. (The new template does not use urlrewrite.xml anymore, among some other changes).

I set the correct configuration 1 by 1 as the tutorial suggests, but now no matter what, the view is always directed to a JSP, so if my controller looks like this:

@RequestMapping(value = "/authors/{authorId}")  
public ModelAndView getAuthorById(@PathVariable String authorId) {  
    Author author = bookService.getAuthorById(authorId);  
    ModelAndView mav =new ModelAndView("bookXmlView", BindingResult.MODEL_KEY_PREFIX+"author", author);  
    return mav;  
}

It would always try to return to a author.jsp view and not the object as XML. I tried many things with no success. Any ideas why this happens and how to fix it?


UPDATE ——————-
As noted I added logs:

I set it as DEBUG level and discovered something:

DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Rejected bean name ‘org.springframework.context.annotation.internalConfigurationAnnotationProcessor’: no URL paths identified
DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Rejected bean name ‘org.springframework.context.annotation.internalAutowiredAnnotationProcessor’: no URL paths identified
DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Rejected bean name ‘org.springframework.context.annotation.internalRequiredAnnotationProcessor’: no URL paths identified
DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Rejected bean name ‘org.springframework.context.annotation.internalCommonAnnotationProcessor’: no URL paths identified
DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Rejected bean name ‘bookXmlView’: no URL paths identified


Notice this line: Rejected bean name ‘bookXmlView’: no URL paths identified.
Searching this indicated maybe a clash between <mvc:annotation-driven /> and my autodetectAnnotations in the xstream settings?

Any case, after invoking the link, I got the following log entry. Notice it forwards the view to /WEB-INF/views/bookXmlView.jsp:

DEBUG: org.springframework.web.servlet.DispatcherServlet – DispatcherServlet with name ‘appServlet’ processing GET request for [/test/page_init]
DEBUG: org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping – Mapping [/page_init] to HandlerExecutionChain with handler [test.test.test.HomeController@a087de] and 2 interceptors
DEBUG: org.springframework.web.servlet.DispatcherServlet – Last-Modified value for [/test/page_init] is: -1
DEBUG: org.springframework.web.bind.annotation.support.HandlerMethodInvoker – Invoking request handler method: public org.springframework.web.servlet.ModelAndView test.test.test.HomeController.getObject()
DEBUG: org.springframework.beans.factory.support.DefaultListableBeanFactory – Invoking afterPropertiesSet() on bean with name ‘bookXmlView’
DEBUG: org.springframework.web.servlet.DispatcherServlet – Rendering view [org.springframework.web.servlet.view.JstlView: name ‘bookXmlView’; URL [/WEB-INF/views/xmlView.jsp]] in DispatcherServlet with name ‘appServlet’
DEBUG: org.springframework.web.servlet.view.JstlView – Added model object ‘org.springframework.validation.BindingResult.books’ of type [test.test.test.ObjectTest] to request in view with name ‘bookXmlView’
DEBUG: org.springframework.web.servlet.view.JstlView – Forwarding to resource [/WEB-INF/views/xmlView.jsp] in InternalResourceView ‘bookXmlView’
DEBUG: org.springframework.web.servlet.DispatcherServlet – Successfully completed request

  • 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-19T12:48:39+00:00Added an answer on May 19, 2026 at 12:48 pm

    Got it at last!
    First I tried a different marshaller – JAXB2 but xstream should work as well.

    Next thing is the definition – turns out for some reason the configuration uses this (wrong):

    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>
    

    using only InternalResourceViewResolver

    while definition for org.springframework.web.servlet.view.BeanNameViewResolver is ignored. The solution for that is to define them both in one bean called ContentNegotiatingViewResolver as follows:

        <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
        <property name="viewResolvers">
                <list>
                        <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
                        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                                <property name="prefix" value="/WEB-INF/jsp/" />
                                <property name="suffix" value=".jsp" />
                        </bean>
                </list>
        </property>
    </bean>
    <oxm:jaxb2-marshaller id="marshaller">
            <oxm:class-to-be-bound name="com.mycompany.dashboard.Person" />
    </oxm:jaxb2-marshaller>
    
    <bean name="person" class="org.springframework.web.servlet.view.xml.MarshallingView">
            <constructor-arg ref="marshaller" />
    </bean>
    

    That configuration solved my problems and person object I played with was not directed to a JSP view but marshaller turn is to an XML:

        @RequestMapping(value = "/person", method = RequestMethod.GET)
    public ModelAndView addPerson() {
        Person person = new Person();
        person.setAddress("address 123");
        person.setAge(50);
        person.setName("Andrew");
        System.out.println("new person: " + person);
        ModelAndView mav = new ModelAndView("person",BindingResult.MODEL_KEY_PREFIX + "person",person);
        return mav;
    

    Hope it would help others in the future too.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.