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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:49:09+00:00 2026-06-14T04:49:09+00:00

in process of exposing existing statefull service as a RESTfull service. I do not

  • 0

in process of exposing existing statefull service as a RESTfull service.

I do not want to make any changes to any existing java class.I have been able to configure other annotations such as @path, @GET using spring-config.xml

spring-config.xml

<!-- Inquiry Services -->
    <bean id="retrieveContactHistoryBP" class="com.csc.fs.ws.contact.history.impl.RetrieveContactHistoryBPService"/>        
    <!-- Update Services -->
    <bean id="startContactBP" class="com.csc.fs.ws.contact.impl.StartContactBPService"/>

    <!-- REST services -->
    <bean id="startContactBPRest" class="com.csc.fs.rest.contact.StartContactBP" scope="prototype" />
    <bean id="retrieveContactHistoryBPRest" class="com.csc.fs.rest.contact.RetrieveContactHistoryBP" scope="prototype" />

    <!-- Exposing beans as rest services -->
    <jaxrs:server id="restServer" address="/rest/">
        <jaxrs:model id="restModel">
            <jaxrs:resource name="com.csc.fs.rest.contact.RetrieveContactHistoryBP" path="retrieveContactHistoryBP">
                <jaxrs:operation name="retrieve" path="{partyId}" consumes="application/json" produces="application/json" verb="GET">
                    <jaxrs:param name="req" type="CONTEXT"/>
                    <jaxrs:param name="partyId" type="PATH"/>
                </jaxrs:operation>
            </jaxrs:resource>
            <jaxrs:resource name="com.csc.fs.rest.contact.StartContactBP" path="startContactBP">
                <jaxrs:operation name="startContact" path="/" consumes="application/json" produces="application/json" verb="PUT">
                    <jaxrs:param name="req" type="CONTEXT"/>
                    <jaxrs:param name="startContact" type="REQUEST_BODY"/>
                </jaxrs:operation>
            </jaxrs:resource>
        </jaxrs:model>
        <jaxrs:serviceBeans>
<!--             <ref bean="startContactBPRest"/> --> <!-- Instead configure above -->
<!--             <ref bean="retrieveContactHistoryBPRest"/> -->
        </jaxrs:serviceBeans>
        <jaxrs:extensionMappings>
            <entry key="feed" value="application/atom+xml"/>
            <entry key="json" value="application/json"/>
            <entry key="xml" value="application/xml"/>
            <entry key="html" value="text/html"/>
        </jaxrs:extensionMappings>

        <jaxrs:providers>
            <ref bean="jaxbProvider"/>
            <ref bean="jsonProvider" />
        </jaxrs:providers>
    </jaxrs:server>

The thing I am facing problem is with the @XmlRootElement. I have not been successful in configuring it through the xml.

And I get the following error when trying to access the REST service

org.apache.cxf.interceptor.Fault
    org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:315)
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
    org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:105)
    org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:188)
    org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)


root cause 

java.lang.NullPointerException
    org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleOperation(WadlGenerator.java:310)
    org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleResource(WadlGenerator.java:253)
    org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleRequest(WadlGenerator.java:185)
    org.apache.cxf.jaxrs.impl.RequestPreprocessor.checkMetadataRequest(RequestPreprocessor.java:189)
    org.apache.cxf.jaxrs.impl.RequestPreprocessor.preprocess(RequestPreprocessor.java:82)
    org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:112)
    org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
    org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
    org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
    org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:105)
    org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
    org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:188)
    org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)

So, Is there a way to configure the information in the XmlRoot annotation externally, so we don’t have to add it to Java code?

  • 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-14T04:49:10+00:00Added an answer on June 14, 2026 at 4:49 am

    From the Apache-cxf documentation on jaxrs-data-bindings:

    Alternatively to using @XmlRootElement and Collection wrappers, one can
    provide an Object factory which will tell JAXB how to marshal a given
    type (in case of Collections – its template type). Another option is to
    return/accept a JAXBElement directly from/in a given method.

    Another option is to register one or more JAX-RS ContextResolver providers
    capable of creating JAXBContexts for a number of different types. The
    default JAXBElementProvider will check these resolvers first before
    attempting to create a JAXBContext on its own.

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

Sidebar

Related Questions

I have a C# class which needs to process a sequence of items (
The process I want to do is to make the FFT to an image
A process running as a non-administrator user does not have rights to write to
I have a Windows Service that is exposing a WCF service thru a net.tcp
Current Process: I have a tar.gz file. (Actually, I have about 2000 of them,
The process is not running as WOW64, its running as x64 in an x64
I wrote a process explorer using C with GUI interface. I want to add
My website currently working in ASP.NET 1.1 Old Process In our database we have
Process.Start(IExplore.exe); Does this always work, on every machine ? If not, how to do
A process is considered to have completed correctly in Linux if its exit status

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.