Hi,
I have a interesting problem.
When i started glassfish server, everythings work fine.
But, i changed some code and published the server, and i run my client
(SistemGirisClientKullaniciDogrula),
application throw java.lang.ClassCastException: tr.com.app.Kullanici cannot
be cast to tr.com.app.Kullanici.
Interesting part is, after the Glassfish server restart, application works
fine.
I am using restlet-spring-hibernate.And i also using jaxb
(org.restlet.ext.jaxb.jar) for converting xml to java object. My application
server is Glassfish v3.0
--detail for congiguration
restlet 2.0.5
spring 3.0.5
hibernate 3.3.2
glassfish v3.0
client class(Just for test)
import java.io.IOException;
import org.restlet.Client;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.MediaType;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.ext.jaxb.JaxbRepresentation;
public class SistemGirisClientKullaniciDogrula {
public static void main(String[] Args) throws IOException {
String url = "http://localhost:8080/Project/sistemgirisws";
Client client = new Client(Protocol.HTTP);
Kullanici kullanici = new Kullanici();
kullanici.setKodu("1");
JaxbRepresentation<Kullanici>
jaxbRepresentationSendingKullanici= new
JaxbRepresentation<Kullanici>(MediaType.APPLICATION_XML, kullanici);
Request request = new Request(Method.GET, url,
jaxbRepresentationSendingKullanici);
Response response = client.handle(request);
JaxbRepresentation<Kullanici> kullaniciResponse = new
JaxbRepresentation<Kullanici>(response.getEntity(), Kullanici.class);
kullanici = kullaniciResponse.getObject();
System.out.println("kullanici id : " + kullanici.getId());
}
}
Web Service
public class ProjectWebService {
/**
*
* @param representation
* @return
*/
@Get
public Representation getKullanici(Representation representation) {
JaxbRepresentation<Kullanici> jaxbRepresentation = new
JaxbRepresentation<Kullanici>(representation, Kullanici.class);
Kullanici kullanici = new Kullanici();
try {
kullanici = jaxbRepresentation.getObject(); //THIS LINE
THROW
java.lang.classCastException tr.com.app.Kullanici cannot be cast to
tr.com.app.Kullanici.
} catch (IOException e) {
e.printStackTrace();
}
try {
kullanici =
sistemGirisBusinessManager.kullaniciDogrula(kullanici);
getResponse().setStatus(Status.SUCCESS_OK);
return new
JaxbRepresentation<Kullanici>(MediaType.APPLICATION_XML,
kullanici);
} catch (Exception exception) {
exception.printStackTrace();
getResponse().setStatus(Status.CLIENT_ERROR_EXPECTATION_FAILED);
return new
JaxbRepresentation<MesajList>(MediaType.APPLICATION_XML,
sistemGirisBusinessManager.getMesajList());
}
}
}
Does Anyone know what is the problem?
Best Regards
Musa YUVACI
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/jaxb-class-which-is-the-same-class-cast-exception-tp6421599p6421599.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2754300