REPOS + Java + Statut de 500 Erreur Interne

OK, donc je suis en train d'écrire un RESTE de serveur à l'aide de Java et d'essayer de le tester, mais j'obtiens le Code d'Erreur 500 s'il vous Plaît aider. J'ai franchi le code et de savoir ce qu'il atteigne le fond de cette méthode avec une liste de tableaux de DataClass objets qui sont correctement formaté (j'ai inspecté et les exécuter sans le RESTE de la fin de devant avec succès).

Voici le RESTE de la méthode, je vais appeler

@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;    
}

Ici est la 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...
}

Et Voici comment je l'appelle le Serveur, je sais que le serveur est appelée correctement parce que j'ai une méthode de test qui retourne une chaîne de caractères.

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));
}

Voici mon erreur

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)

Désolé j'ai oublié inclure des choses

La classe où la receiveXML a ce

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

et voici le web.xml fichier

<?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>

et cela fonctionne très bien (il n'est de retourner une chaîne de caractères)

Voici le client

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

Voici le côté serveur

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

Merci
twain249

500 signifie l'erreur dans le côté serveur, donc vous avez besoin de vérifier les journaux/sortie à partir de votre serveur pour déterminer le problème.

OriginalL'auteur twain249 | 2012-02-29