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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:09:31+00:00 2026-05-30T15:09:31+00:00

OK so I’m writing a REST server using Java and trying to test it

  • 0

OK so I’m writing a REST server using Java and trying to test it but I keep getting Error Code 500 Please help. I’ve stepped through the code and know it reaches the bottom of this method with an ArrayList of DataClass objects that are correctly formatted (I’ve inspected them and run without the REST front end successfully).

Here is the REST method I’m calling

@GET
    @Produces(MediaType.APPLICATION_XML)
    public List<DataClass> receiveXML(
            @DefaultValue("null") @QueryParam("artist") String artist,
            @DefaultValue("null") @QueryParam("title") String title,
            @DefaultValue("null") @QueryParam("album") String album,
            @DefaultValue("null") @QueryParam("genre") String genre,
            @DefaultValue("null") @QueryParam("type") String type,
            @DefaultValue("false") @QueryParam("open") Boolean open,
            @DefaultValue("false") @QueryParam("close") Boolean close,
            @DefaultValue("noPath") @QueryParam("path") String path,
            @DefaultValue("noKey") @QueryParam("key") String key,
            @DefaultValue("null") @QueryParam("show") String show,
            @DefaultValue("null") @QueryParam("season") String season,
            @DefaultValue("null") @QueryParam("format") String format)
    {   

        if(!artist.equals("null"))
            this.artist = artist;
        if(!title.equals("null"))
            this.title = title;
        if(!album.equals("null"))
            this.album = album;
        if(!genre.equals("null"))
            this.genre = genre;
        if(!type.equals("null"))
            this.type = type;
        if(!open.equals("false"))
            this.open = open;
        if(!close.equals("false"))
            this.close = close;
        if(!path.equals("noPath"))
            this.path = path;
        if(!key.equals("noKey"))
            this.keyword = key;
        if(!show.equals("null"))
            this.show = show;
        if(!season.equals("null"))
            this.season = season;
        if(!format.equals("null"))
            this.format = format;

        MultivaluedMap<String,String> queryParams = buildMap();
        List<DataClass> resp = receive(queryParams);
        return resp;    
    }

Here is the DataClass

@XmlRootElement
public class DataClass {
    public String pathname;
    ArrayList<String> parsedSet;
    ResultSet resultSet;
    public String id, path, type, category, size, update, idMeta, title, description;
    public String genre, album, artist, show, season;

    public DataClass(ResultSet resultSet){
        this.resultSet = resultSet;
        parsedSet = new ArrayList<String>();
        setStringVariables();
    }
    /**
     * Sets the pathname variable of the local file to be returned
     * @param pathname
     */
    public DataClass(String pathname){
        this.pathname = pathname;
    }


        methods to set the fields...

}

And Here is how I call the Server, I know that the server is being invoked correctly because I have a test method that just returns a string.

public static void testXML() {
    //a map that adds parameters that will then be added to the the WebService
    MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
    queryParams.add("type", "music");
    //retrieve info for an artist in XML format
    System.out.println(service.path("rest").path("media").queryParams(queryParams).accept(
            MediaType.APPLICATION_XML).get(String.class));
}

Here is my error

Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/TigrisRESTServer/rest/media?type=music returned a response status of 500 Internal Server Error
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:676)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:503)
    at tigris.restserver.client.ourClient.testXML(ourClient.java:45)
    at tigris.restserver.client.ourClient.main(ourClient.java:28)

Sorry I forgot to include some stuff

The class where the receiveXML is defined has this

@Path("/media")
public class Server {
}

and here is the web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>RestServer</display-name>
  <servlet>
    <servlet-name>Tigris REST Server App</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>tigris.restserver.connection</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Tigris REST Server App</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
</web-app>

and this works fine (all it does is return a string)

Here’s the client

public static void testTEST() {
    System.out.println(service.path("rest").path("media").accept(
            MediaType.TEXT_PLAIN).get(String.class));
}

Here’s the server side

@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
    return "Hello Server";
}

Thank you
twain249

  • 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-30T15:09:33+00:00Added an answer on May 30, 2026 at 3:09 pm

    Seems like you forgot to include what path it’s supposed to map against.

    @Path("/rest/")
    
    GET http://localhost:8080/TigrisRESTServer/rest/media?type=music
    

    if you want to map against the URL /rest/ that is.

    For example, see this link Jersey Documentation

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

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.