Problem with REST

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;


@Path("/getdates")
public class FlyedpResource {



    @GET
    @Path("{date}")
    @Produces({"application/json"})
    public Response get(@PathParam("date") String date) throws IOException


    {

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

            comb = x.getcomb(date);



              System.out.println(comb.toString());

        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;
	@SuppressWarnings("rawtypes")
	private   ArrayList combinations = new ArrayList();


	public FlysCombination(String session,ArrayList combinations)
	{
            this.session=session;
            this.combinations=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);
         combinations.add(fly);
     session="sdjkbsqdjhf";
     FlysCombination flycomb =new FlysCombination (session,combinations);


             return(flycomb);


}



}

Open in new window


package converter;

public class FlyedpConverter

{


private String keydate;



public FlyedpConverter(String keydate)
{
    this.keydate=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
keviin555Asked:
Who is Participating?
 
objectsCommented:
check your server log for the underlying cause of the problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.