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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:30:13+00:00 2026-05-23T02:30:13+00:00

I am trying to use the Apache CXF JAX-RS Client API code found here

  • 0

I am trying to use the Apache CXF JAX-RS Client API code found here. However, when I run the client it throws this:

Exception in thread "main" java.lang.NullPointerException
    at java.util.HashMap.<init>(HashMap.java:223)
    at org.restlet.ext.jaxrs.internal.core.ResponseBuilderImpl.clone(ResponseBuilderImpl.java:126)
    at org.restlet.ext.jaxrs.internal.core.ResponseBuilderImpl.clone(ResponseBuilderImpl.java:62)
    at org.apache.cxf.jaxrs.client.AbstractClient.setResponseBuilder(AbstractClient.java:374)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:451)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:445)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:177)
    at $Proxy12.foo(Unknown Source)
    at com.paml.JaxTestClient.main(JaxTestClient.java:20)

Here is my client:

public class JaxTestClient {

    public static void main( String[] args ) {
        // Works with Restlet API - but paths are not mapped automatically
        // JaxExampleEcho jaxExampleEcho = ClientResource.create( "http://localhost:8111/", JaxExampleEcho.class );

        JaxExampleEcho jaxExampleEcho = JAXRSClientFactory.create( "http://localhost:8111/", JaxExampleEcho.class );
        System.out.println( jaxExampleEcho.foo() );
        System.out.println( jaxExampleEcho.bar() );
        System.out.println( jaxExampleEcho.baz() );
    }
}

And here is the interface:

@Path( "/" )
public interface JaxExampleEcho {

    @GET
    @Path( "foo" )
    @Produces( "text/plain" )
    String foo();

    @GET
    @Path( "bar" )
    @Produces( "text/plain" )
    String bar();

    @GET
    @Path( "baz" )
    @Produces( "text/plain" )
    String baz();

}

When I run it in a browser with the correct URL’s it works fine, and in fact I see the proper requests on the server side:

Jun 9, 2011 11:06:03 AM org.restlet.engine.log.LogFilter afterHandle
INFO: 2011-06-09    11:06:03    127.0.0.1   -   -   8111    GET /foo    -   200 3   0   1   http://localhost:8111   Apache CXF 2.4.0    -

I’m baffled as to what could be causing this. I thought maybe I missed a dependency, so I went back and checked that and added a couple more. I thought maybe I missed something in the documentation, but I’m not seeing anything.

Am I missing something obvious? Does anyone know how to make this work?

Thanks.

  • 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-23T02:30:14+00:00Added an answer on May 23, 2026 at 2:30 am

    The problem was not CXF. The problem was the JAX-RS restlet extension that was on my path. Adding the following to my pom:

            <exclusions>
                <exclusion>
                    <artifactId>org.restlet</artifactId>
                    <groupId>org.restlet</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>org.restlet.ext.xstream</artifactId>
                    <groupId>org.restlet.jse</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>org.restlet.ext.jaxrs</artifactId>
                    <groupId>org.restlet.jse</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>org.restlet.ext.slf4j</artifactId>
                    <groupId>org.restlet.jse</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>org.restlet</artifactId>
                    <groupId>org.restlet.jse</groupId>
                </exclusion>
            </exclusions>
    

    Fixed it for me.

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

Sidebar

Related Questions

I'm trying to use embedded ActiveMQ broker for unit testing, as explained here: http://activemq.apache.org/how-to-unit-test-jms-code.html
I'm trying to use Hyperjaxb3 with Apache CXF to generate persistence annotations from a
I am trying to use the import of org.apache. However when I put it
I'm trying to use the latest (4.0.1) Apache http core components library. However, my
I am trying to use the archetype: org.apache.cxf.archetype:cxf-jaxws-javafirst and do a Maven compile. Am
I am trying to write a WS client using Apache CXF framework. Remote WS
Im trying to use apache HttpClient 4.1.2 but the debugger shows org.apache.http.client.httpclient is abstract;
I'm trying to use Apache Lucene for tokenizing, and I am baffled at the
I am trying to use GLSMultipleLinearRegression (from apache commons-math package) for multiple linear regression.
I am trying to figure out how to use Apache Commons IO DirectoryWalker .

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.