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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:27:53+00:00 2026-06-16T16:27:53+00:00

I trying to use this example and learn how to call to rest service,

  • 0

I trying to use this example and learn how to call to rest service,
when I put this code I getting error since the eclipse doesn’t know
the org.example.Customer; .the error in definition Customer customer.
how can I import it to my project ?
I have tried to use the eclipse suggestion without success. (fix project setup etc)

import java.util.List;
import javax.ws.rs.core.MediaType;
import org.example.Customer;
import com.sun.jersey.api.client.*;


public class JerseyClient {

   public static void main(String[] args) {
      Client client = Client.create();
      WebResource resource =
        client.resource("http://localhost:8080/CustomerService/rest/customers");

      // Get response as String
      String string = resource.path("1")
        .accept(MediaType.APPLICATION_XML)
            .get(String.class);
      System.out.println(string);

      // Get response as Customer
      Customer customer = resource.path("1") ------"*Here is the error in customer*-------
        .accept(MediaType.APPLICATION_XML)
            .get(Customer.class);
      System.out.println(customer.getLastName() + ", "+ customer.getFirstName());

      // Get response as List<Customer>
      List<Customer> customers = resource.path("findCustomersByCity/Any%20Town")
        .accept(MediaType.APPLICATION_XML)
            .get(new GenericType<List<Customer>>(){});
      System.out.println(customers.size());
   }
}

I have used the code from this blog

http://blog.bdoughan.com/2010/08/creating-restful-web-service-part-55.html

  • 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-16T16:27:54+00:00Added an answer on June 16, 2026 at 4:27 pm

    Could be

    1: is the import statement import org.example.Customer; underlined in red?

    2: the class Customer is that inside a jar? or another project in your workspace? or where is it located?

    3: Are there any chances that there could be two jars on your classpath that contains the class Customer?

    4: if its in a project, did you first build that project?

    update , see in the link here

    enter image description here

    they have shown the packaging and deployment organization, see the Customer class is inside CustomerService.jar which is inside CustomerService.war. do you have these items?

    Dude did you follow the tutorial well?

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

Sidebar

Related Questions

I'm trying to learn php but something goes wrong... When I use this code:
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
i am trying to use this code: <%= File.ReadAllText(Server.MapPath(Members/newsletters/welcome.html))%> which works great but now
I am trying to learn how to use threads with python. this is the
Since I am trying to learn WPF I see more and more the use
This is a noob question. I'm trying to learn how to use SWIG to
Hello I am trying to use WritableBitmap.BackBuffer as used in this example , see
I started this example project to learn meteor: https://github.com/andrewarrow/question-raven/ I'm trying to duplicated a
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()

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.