Problem with REST

Posted on 2011-04-24
Medium Priority
Last Modified: 2012-05-11
Hello ,
i tire to write a REST web - service with java ( netbean , glassfish and jersey)

i write a very simple code and it work . But when i tried to make something like this :

package service;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import converter.FlyedpConverter;
import entities.FlysCombination;

public class FlyedpResource {

    public Response get(@PathParam("date") String date) throws IOException


        FlysCombination comb =new  FlysCombination();
	      FlysCombination x = FlysCombination.instance();

            comb = x.getcomb(date);


        if(comb == null)
            return Response.status(Response.Status.NOT_FOUND).build();
        return Response.ok(comb).build();

Open in new window

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package entities;

import converter.FlyedpConverter;
import java.util.ArrayList;

 * @author mehdi
public class FlysCombination {

    public FlysCombination ()


    public static FlysCombination flycomb=null;

     public static FlysCombination instance()
        if(flycomb == null)
            flycomb=new FlysCombination();
        return flycomb;

	private  String session;
	private   ArrayList combinations = new ArrayList();

	public FlysCombination(String session,ArrayList combinations)



        	public ArrayList getcombinations() {
		return combinations;
	public void setcombinations(ArrayList goingthere) {
		this.combinations = goingthere;

public String getsession() {
		return session;

public void setsession(String session) {
		this.session = session;

public FlysCombination getcomb(String a)
     FlyedpConverter fly = new FlyedpConverter (a);
     FlysCombination flycomb =new FlysCombination (session,combinations);




Open in new window

package converter;

public class FlyedpConverter


private String keydate;

public FlyedpConverter(String keydate)

public String getkeydate() {
	return keydate;
public void setkeydate(String keydate) {
	this.keydate = keydate;


Open in new window

i have this error :

Status: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:268) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1029) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:680)

i think that the problem is in the @XmlRootElement , i dont found where write it ... Help me please
Question by:keviin555
1 Comment
LVL 92

Accepted Solution

objects earned 2000 total points
ID: 35464041
check your server log for the underlying cause of the problem

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question