Re: Unable to find converter for java.util.UUID

2015-03-16 Thread Thierry Boileau
Hi,

I guess I understand what happens.
Initially, the conversions between the UUID instance and a flow of bytes
and vice versa was taken into account by the default converter shipped with
the core Restlet Framework jar (org.restlet.jar).
More precisely, these conversions leveraged the bean serialization provided
by the JDK (ObjectInputStream and ObjectOutputStream objects). As reported
here: https://github.com/restlet/restlet-framework-java/issues/778, such
classes are to be used very cautiously, and have been deactivated by
default since RF 2.1.4.

This explains why your code works in RF 2.0.3, and not in RF 2.2. You can
still activate it by setting the sytem property
"org.restlet.representation.ObjectRepresentation.VARIANT_OBJECT_BINARY_SUPPORTED"
to true.

At this point:
 - either you rely on the JDK serialization (but take really care because
you expose your API to security issues), which will allow you to
serialize/deserialize beans on both sides.
 - or you don't need serialize any other beans, so, you can keep the
"String" return parameter
 - or you still want to exchange beans,then you must rely on other
converter (for example: Jackson).

Having said that, I've made a test using UUID, and it works with the
Jackson extension.

Best regards,
Thierry Boileau






2015-03-16 16:08 GMT+01:00 Chirayu Desai :

> Hi. Thanks for the prompt reply.
>
> I am using the following:
>
> org.restlet.jar
> And for the ext. I am using the following
> 1.fileupload
> 2.slf4j
> 3.xml
> 4.servlet
>
> This on the server side..
>
> On the client side I have org.restlet.jar only..
>
> 
> I will also try your work around that you sent regarding returning the
> String instead of UUID and get back to you with the results. However it
> would be great if the problem solves at an architecture level and not
> specific to this class only.
>
> On Mon, Mar 16, 2015 at 7:51 PM, Thierry Boileau-4 [via Restlet Discuss] 
> <[hidden
> email] > wrote:
>
>> Hi,
>>
>> a workaround is to return a String instance:
>>
>> public UUID authenticateUser(String username, String passwd) {
>>
>> [...]
>> return resource.loginUser().toString();
>> [...]
>> }
>>
>> Best regards,
>> Thierry Boileau
>>
>> 2015-03-16 15:12 GMT+01:00 Thierry Boileau <[hidden email]
>> >:
>>
>>> Hello,
>>>
>>> could you tell us what kind of converters are you using on server side,
>>> and those on client side?
>>> If this question is not clear, could you send us the list of extensions
>>> used on both side (all jars like org.restlet.ext.*).
>>>
>>> Best regards,
>>> Thierry Boileau
>>>
>>> 2015-03-16 12:30 GMT+01:00 Chirayu Desai <[hidden email]
>>> >:
>>>
 I am working on a client server application. I was using Restlet 2.0.3.
 Due
 to a heavy load task my client was getting timed-out. I searched on the
 forum and found that switching over to Restlet 2.2 would help. So I did
 that. I upgraded my Restlet to 2.2.1. But now my code has stopped
 working at
 precisely this method.

 *public synchronized UUID generateUniqueSessionId(String userAtDomain)
 {
 UUID newSessionId = UUID.randomUUID();
 SessionAttributes sessionAttributes = new SessionAttributes();
 sessionAttributes.setAlive(true);
 sessionAttributes.setFQUserName(userAtDomain);
 loggedInUsers.put(newSessionId, sessionAttributes);
 return newSessionId;
 }*
 So I am returning the UUID at last. This code is on the server and
 invoked
 during login. Following is the error that I am getting from the logs.

 *16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object
 :
 f3d2edda-443c-454d-856a-fb4e7ed9c535*

 And this object referred in the log belongs to java.util.UUID

 The code on the client side which invokes the server looks like this.

 *public UUID authenticateUser(String username, String passwd) {

 try {
 String url =
 RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
 username + "/" + passwd;

 Context context = new Context();

 Client client = new Client(context, Protocol.HTTP);
 ClientHelper helper = new ClientHelper(client);
 helper.getHelpedParameters().set("socketConnectTimeoutMs",
 "6");

 ClientResource cr = new ClientResource(url);
 LoginLogoutResource resource =
 cr.wrap(LoginLogoutResource.class);
 return resource.loginUser();
 } catch (ResourceException re) {
 if (re.getStatus().isConnectorError()) {
 try {
 RESTLetWebSvcsFactory.enableFallBackServer();
 

Re: Unable to find converter for java.util.UUID

2015-03-16 Thread Chirayu Desai
Hi. Thanks for the prompt reply.

I am using the following:

org.restlet.jar
And for the ext. I am using the following
1.fileupload
2.slf4j
3.xml
4.servlet

This on the server side..

On the client side I have org.restlet.jar only..


I will also try your work around that you sent regarding returning the
String instead of UUID and get back to you with the results. However it
would be great if the problem solves at an architecture level and not
specific to this class only.

On Mon, Mar 16, 2015 at 7:51 PM, Thierry Boileau-4 [via Restlet Discuss] <
ml-node+s1400322n7579360...@n2.nabble.com> wrote:

> Hi,
>
> a workaround is to return a String instance:
>
> public UUID authenticateUser(String username, String passwd) {
>
> [...]
> return resource.loginUser().toString();
> [...]
> }
>
> Best regards,
> Thierry Boileau
>
> 2015-03-16 15:12 GMT+01:00 Thierry Boileau <[hidden email]
> >:
>
>> Hello,
>>
>> could you tell us what kind of converters are you using on server side,
>> and those on client side?
>> If this question is not clear, could you send us the list of extensions
>> used on both side (all jars like org.restlet.ext.*).
>>
>> Best regards,
>> Thierry Boileau
>>
>> 2015-03-16 12:30 GMT+01:00 Chirayu Desai <[hidden email]
>> >:
>>
>>> I am working on a client server application. I was using Restlet 2.0.3.
>>> Due
>>> to a heavy load task my client was getting timed-out. I searched on the
>>> forum and found that switching over to Restlet 2.2 would help. So I did
>>> that. I upgraded my Restlet to 2.2.1. But now my code has stopped
>>> working at
>>> precisely this method.
>>>
>>> *public synchronized UUID generateUniqueSessionId(String userAtDomain)
>>> {
>>> UUID newSessionId = UUID.randomUUID();
>>> SessionAttributes sessionAttributes = new SessionAttributes();
>>> sessionAttributes.setAlive(true);
>>> sessionAttributes.setFQUserName(userAtDomain);
>>> loggedInUsers.put(newSessionId, sessionAttributes);
>>> return newSessionId;
>>> }*
>>> So I am returning the UUID at last. This code is on the server and
>>> invoked
>>> during login. Following is the error that I am getting from the logs.
>>>
>>> *16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object :
>>> f3d2edda-443c-454d-856a-fb4e7ed9c535*
>>>
>>> And this object referred in the log belongs to java.util.UUID
>>>
>>> The code on the client side which invokes the server looks like this.
>>>
>>> *public UUID authenticateUser(String username, String passwd) {
>>>
>>> try {
>>> String url =
>>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>>> username + "/" + passwd;
>>>
>>> Context context = new Context();
>>>
>>> Client client = new Client(context, Protocol.HTTP);
>>> ClientHelper helper = new ClientHelper(client);
>>> helper.getHelpedParameters().set("socketConnectTimeoutMs",
>>> "6");
>>>
>>> ClientResource cr = new ClientResource(url);
>>> LoginLogoutResource resource =
>>> cr.wrap(LoginLogoutResource.class);
>>> return resource.loginUser();
>>> } catch (ResourceException re) {
>>> if (re.getStatus().isConnectorError()) {
>>> try {
>>> RESTLetWebSvcsFactory.enableFallBackServer();
>>> String url =
>>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>>> username + "/" + passwd;
>>> ClientResource cr = new ClientResource(url);
>>> LoginLogoutResource resource =
>>> cr.wrap(LoginLogoutResource.class);
>>> return resource.loginUser();
>>> } catch (ResourceException re1) {
>>> int statusCode = new
>>> RESTLetErrorHandler().handleServerError(re);
>>> if (statusCode != -1) {
>>> throw new UserCRUDException(statusCode);
>>> }
>>> }
>>> } else {
>>> throw new UserCRUDException(new
>>> RESTLetErrorHandler().handleServerError(re));
>>> }
>>> }
>>> return null;
>>> }*
>>> Note: USERCRUDException is my own exception and not one of JAVA
>>>
>>> Please help me resolve this problem which probably prevents returning the
>>> UUID from the server and thus my application isn't moving ahead.
>>>
>>> Thanks in advance
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358.html
>>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>>
>>> --
>>>
>>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105559
>>>
>>
>>
>

Re: Restelt Client Internal Connector Error (1002)

2015-03-16 Thread Chirayu Desai
Some responses from server may take time however the one in the code
snippet wont.
yes setting timeout on client works fine i can make the client wait for
more the the default time out of one minute, already tested it.

On Mon, Mar 16, 2015 at 8:02 PM, Thierry Boileau-4 [via Restlet Discuss] <
ml-node+s1400322n7579361...@n2.nabble.com> wrote:

> Hello,
>
> some things are not clear to me:
>  - are you sure the server answers quickly, or do know that the server
> takes time?
>  - when you set up time out on client side, does it have any effect?
>
> Best regards,
> Thierry Boileau
>
> 2015-03-16 6:11 GMT+01:00 Chirayu Desai <[hidden email]
> >:
>
>> Hi,
>> Followin are my code snippets:
>>
>> At Client RESTLet :
>>
>> @Override
>> public Task getTask(int taskId) {
>>
>> logger.debug(" RESTLetTaskDAO.getTask taskid = {} ", taskId);
>> Task task = null;
>> try {
>> final Context context = new Context();
>> context.getParameters().set("socketTimeout", "12");
>>
>> String url = RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() +
>> "task/"
>> +sessionId;
>>   ClientResource cr = new ClientResource(context,url);
>> TaskResource resource = cr.wrap(TaskResource.class);
>> *task = resource.getTask(taskId);*
>> }
>> catch (ResourceException re) {
>> int statusCode = new RESTLetErrorHandler().handleServerError(re);
>> if (statusCode != -1){
>> throw new CRUDException(statusCode);
>> }
>> }
>> return task;
>> }
>>
>>
>> At Server Restlet :
>>
>> @Get
>> public Task getTask(int taskId) throws CRUDException,
>> SessionTerminatedException {
>>
>> String userSessionId = (String)
>> this.getRequest().getAttributes().get("sessionid");
>> TaskDAO taskDAO = DAOFactory.getDefaultFactory().getTaskDAO();
>> Task task = taskDAO.getTask(taskId);
>> if (task != null) {
>> logger.trace("TaskResourceImpl.getTask sessionid = {}, task fetched =
>> {}",task.toFormattedString());
>> }
>> else {
>> logger.error("TaskResourceImpl.getTask No task matching criteria found -
>> task is null");
>> }
>> return task;
>> }
>>
>>
>> The error log At server :
>>
>> 16 Mar 2015 10:27:00  INFO - 2015-03-16 10:27:00 127.0.0.1 - 127.0.0.1
>> 8080 GET
>> /purpledocsstar_svr/tasks/0/0/null/0/all/null/null/c300647c-7fcb-45bf-a45a-9d7cf87b4598
>> - 200 - 0 60026 http://localhost:8080 Restlet-Framework/2.0.13 -
>> 16 Mar 2015 10:27:09 DEBUG - ErrorStatusService.getStatus code Throwable
>> throwable,UniformResource resource
>> 16 Mar 2015 10:27:09 DEBUG - ErrorStatusService.getStatus Throwable
>> throwable, Request request, Response response
>> 16 Mar 2015 10:27:09  INFO - ErrorStatusService.getStatus - throwable NOT
>> instanceof DBCRUDException
>> 16 Mar 2015 10:27:09  INFO - ErrorStatusService.getStatus - throwable NOT
>> instanceof DBCRUDException
>> 16 Mar 2015 10:27:09  WARN - Exception or error caught in resource
>> java.lang.IllegalArgumentException
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.restlet.resource.ServerResource.doHandle(ServerResource.java:449)
>> at org.restlet.resource.ServerResource.get(ServerResource.java:648)
>> at org.restlet.resource.ServerResource.doHandle(ServerResource.java:530)
>> at
>> org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
>> at
>> org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
>> at org.restlet.resource.ServerResource.handle(ServerResource.java:849)
>> at org.restlet.resource.Finder.handle(Finder.java:513)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Router.doHandle(Router.java:500)
>> at org.restlet.routing.Router.handle(Router.java:740)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at
>> org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:154)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
>> at
>> org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
>> at org.restlet.Application.handle(Application.java:391)
>> at org.restlet.routing.Filter.doHandle(Filter.java:159)
>> at org.restlet.routing.Filter.handle(Filter.java:206)
>> at org.restlet.routing.Router.doHandle(Router.jav

Re: Restelt Client Internal Connector Error (1002)

2015-03-16 Thread Thierry Boileau
Hello,

some things are not clear to me:
 - are you sure the server answers quickly, or do know that the server
takes time?
 - when you set up time out on client side, does it have any effect?

Best regards,
Thierry Boileau

2015-03-16 6:11 GMT+01:00 Chirayu Desai :

> Hi,
> Followin are my code snippets:
>
> At Client RESTLet :
>
> @Override
> public Task getTask(int taskId) {
>
> logger.debug(" RESTLetTaskDAO.getTask taskid = {} ", taskId);
> Task task = null;
> try {
> final Context context = new Context();
> context.getParameters().set("socketTimeout", "12");
>
> String url = RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() +
> "task/"
> +sessionId;
>   ClientResource cr = new ClientResource(context,url);
> TaskResource resource = cr.wrap(TaskResource.class);
> *task = resource.getTask(taskId);*
> }
> catch (ResourceException re) {
> int statusCode = new RESTLetErrorHandler().handleServerError(re);
> if (statusCode != -1){
> throw new CRUDException(statusCode);
> }
> }
> return task;
> }
>
>
> At Server Restlet :
>
> @Get
> public Task getTask(int taskId) throws CRUDException,
> SessionTerminatedException {
>
> String userSessionId = (String)
> this.getRequest().getAttributes().get("sessionid");
> TaskDAO taskDAO = DAOFactory.getDefaultFactory().getTaskDAO();
> Task task = taskDAO.getTask(taskId);
> if (task != null) {
> logger.trace("TaskResourceImpl.getTask sessionid = {}, task fetched =
> {}",task.toFormattedString());
> }
> else {
> logger.error("TaskResourceImpl.getTask No task matching criteria found -
> task is null");
> }
> return task;
> }
>
>
> The error log At server :
>
> 16 Mar 2015 10:27:00  INFO - 2015-03-16 10:27:00 127.0.0.1 - 127.0.0.1
> 8080 GET
> /purpledocsstar_svr/tasks/0/0/null/0/all/null/null/c300647c-7fcb-45bf-a45a-9d7cf87b4598
> - 200 - 0 60026 http://localhost:8080 Restlet-Framework/2.0.13 -
> 16 Mar 2015 10:27:09 DEBUG - ErrorStatusService.getStatus code Throwable
> throwable,UniformResource resource
> 16 Mar 2015 10:27:09 DEBUG - ErrorStatusService.getStatus Throwable
> throwable, Request request, Response response
> 16 Mar 2015 10:27:09  INFO - ErrorStatusService.getStatus - throwable NOT
> instanceof DBCRUDException
> 16 Mar 2015 10:27:09  INFO - ErrorStatusService.getStatus - throwable NOT
> instanceof DBCRUDException
> 16 Mar 2015 10:27:09  WARN - Exception or error caught in resource
> java.lang.IllegalArgumentException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.restlet.resource.ServerResource.doHandle(ServerResource.java:449)
> at org.restlet.resource.ServerResource.get(ServerResource.java:648)
> at org.restlet.resource.ServerResource.doHandle(ServerResource.java:530)
> at
> org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:590)
> at
> org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:302)
> at org.restlet.resource.ServerResource.handle(ServerResource.java:849)
> at org.restlet.resource.Finder.handle(Finder.java:513)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Router.doHandle(Router.java:500)
> at org.restlet.routing.Router.handle(Router.java:740)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at
> org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:154)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
> at
> org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:75)
> at org.restlet.Application.handle(Application.java:391)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Router.doHandle(Router.java:500)
> at org.restlet.routing.Router.handle(Router.java:740)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.routing.Router.doHandle(Router.java:500)
> at org.restlet.routing.Router.handle(Router.java:740)
> at org.restlet.routing.Filter.doHandle(Filter.java:159)
> at org.restlet.routing.Filter.handle(Filter.java:206)
> at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
> at org.restlet.Component.handle(Component.java:391)
> at org.restlet.Serv

Re: Unable to find converter for java.util.UUID

2015-03-16 Thread Thierry Boileau
Hi,

a workaround is to return a String instance:

public UUID authenticateUser(String username, String passwd) {

[...]
return resource.loginUser().toString();
[...]
}

Best regards,
Thierry Boileau

2015-03-16 15:12 GMT+01:00 Thierry Boileau :

> Hello,
>
> could you tell us what kind of converters are you using on server side,
> and those on client side?
> If this question is not clear, could you send us the list of extensions
> used on both side (all jars like org.restlet.ext.*).
>
> Best regards,
> Thierry Boileau
>
> 2015-03-16 12:30 GMT+01:00 Chirayu Desai :
>
>> I am working on a client server application. I was using Restlet 2.0.3.
>> Due
>> to a heavy load task my client was getting timed-out. I searched on the
>> forum and found that switching over to Restlet 2.2 would help. So I did
>> that. I upgraded my Restlet to 2.2.1. But now my code has stopped working
>> at
>> precisely this method.
>>
>> *public synchronized UUID generateUniqueSessionId(String userAtDomain)
>> {
>> UUID newSessionId = UUID.randomUUID();
>> SessionAttributes sessionAttributes = new SessionAttributes();
>> sessionAttributes.setAlive(true);
>> sessionAttributes.setFQUserName(userAtDomain);
>> loggedInUsers.put(newSessionId, sessionAttributes);
>> return newSessionId;
>> }*
>> So I am returning the UUID at last. This code is on the server and invoked
>> during login. Following is the error that I am getting from the logs.
>>
>> *16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object :
>> f3d2edda-443c-454d-856a-fb4e7ed9c535*
>>
>> And this object referred in the log belongs to java.util.UUID
>>
>> The code on the client side which invokes the server looks like this.
>>
>> *public UUID authenticateUser(String username, String passwd) {
>>
>> try {
>> String url =
>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>> username + "/" + passwd;
>>
>> Context context = new Context();
>>
>> Client client = new Client(context, Protocol.HTTP);
>> ClientHelper helper = new ClientHelper(client);
>> helper.getHelpedParameters().set("socketConnectTimeoutMs",
>> "6");
>>
>> ClientResource cr = new ClientResource(url);
>> LoginLogoutResource resource =
>> cr.wrap(LoginLogoutResource.class);
>> return resource.loginUser();
>> } catch (ResourceException re) {
>> if (re.getStatus().isConnectorError()) {
>> try {
>> RESTLetWebSvcsFactory.enableFallBackServer();
>> String url =
>> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
>> username + "/" + passwd;
>> ClientResource cr = new ClientResource(url);
>> LoginLogoutResource resource =
>> cr.wrap(LoginLogoutResource.class);
>> return resource.loginUser();
>> } catch (ResourceException re1) {
>> int statusCode = new
>> RESTLetErrorHandler().handleServerError(re);
>> if (statusCode != -1) {
>> throw new UserCRUDException(statusCode);
>> }
>> }
>> } else {
>> throw new UserCRUDException(new
>> RESTLetErrorHandler().handleServerError(re));
>> }
>> }
>> return null;
>> }*
>> Note: USERCRUDException is my own exception and not one of JAVA
>>
>> Please help me resolve this problem which probably prevents returning the
>> UUID from the server and thus my application isn't moving ahead.
>>
>> Thanks in advance
>>
>>
>>
>> --
>> View this message in context:
>> http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358.html
>> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>>
>> --
>>
>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105559
>>
>
>
>
> --
> *Thierry Boileau, Mr B*
> +1 (408) 387-3184 • tboil...@restlet.com
>
> 
> 6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France
>



-- 
*Thierry Boileau, Mr B*
+1 (408) 387-3184 • tboil...@restlet.com


6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105600

Re: Unable to find converter for java.util.UUID

2015-03-16 Thread Thierry Boileau
Hello,

could you tell us what kind of converters are you using on server side, and
those on client side?
If this question is not clear, could you send us the list of extensions
used on both side (all jars like org.restlet.ext.*).

Best regards,
Thierry Boileau

2015-03-16 12:30 GMT+01:00 Chirayu Desai :

> I am working on a client server application. I was using Restlet 2.0.3. Due
> to a heavy load task my client was getting timed-out. I searched on the
> forum and found that switching over to Restlet 2.2 would help. So I did
> that. I upgraded my Restlet to 2.2.1. But now my code has stopped working
> at
> precisely this method.
>
> *public synchronized UUID generateUniqueSessionId(String userAtDomain)
> {
> UUID newSessionId = UUID.randomUUID();
> SessionAttributes sessionAttributes = new SessionAttributes();
> sessionAttributes.setAlive(true);
> sessionAttributes.setFQUserName(userAtDomain);
> loggedInUsers.put(newSessionId, sessionAttributes);
> return newSessionId;
> }*
> So I am returning the UUID at last. This code is on the server and invoked
> during login. Following is the error that I am getting from the logs.
>
> *16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object :
> f3d2edda-443c-454d-856a-fb4e7ed9c535*
>
> And this object referred in the log belongs to java.util.UUID
>
> The code on the client side which invokes the server looks like this.
>
> *public UUID authenticateUser(String username, String passwd) {
>
> try {
> String url =
> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
> username + "/" + passwd;
>
> Context context = new Context();
>
> Client client = new Client(context, Protocol.HTTP);
> ClientHelper helper = new ClientHelper(client);
> helper.getHelpedParameters().set("socketConnectTimeoutMs",
> "6");
>
> ClientResource cr = new ClientResource(url);
> LoginLogoutResource resource =
> cr.wrap(LoginLogoutResource.class);
> return resource.loginUser();
> } catch (ResourceException re) {
> if (re.getStatus().isConnectorError()) {
> try {
> RESTLetWebSvcsFactory.enableFallBackServer();
> String url =
> RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
> username + "/" + passwd;
> ClientResource cr = new ClientResource(url);
> LoginLogoutResource resource =
> cr.wrap(LoginLogoutResource.class);
> return resource.loginUser();
> } catch (ResourceException re1) {
> int statusCode = new
> RESTLetErrorHandler().handleServerError(re);
> if (statusCode != -1) {
> throw new UserCRUDException(statusCode);
> }
> }
> } else {
> throw new UserCRUDException(new
> RESTLetErrorHandler().handleServerError(re));
> }
> }
> return null;
> }*
> Note: USERCRUDException is my own exception and not one of JAVA
>
> Please help me resolve this problem which probably prevents returning the
> UUID from the server and thus my application isn't moving ahead.
>
> Thanks in advance
>
>
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> --
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105559
>



-- 
*Thierry Boileau, Mr B*
+1 (408) 387-3184 • tboil...@restlet.com


6 Rue Rose Dieng-Kuntz • Nantes, 44300 • France

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105597

Unable to find converter for java.util.UUID

2015-03-16 Thread Chirayu Desai
I am working on a client server application. I was using Restlet 2.0.3. Due
to a heavy load task my client was getting timed-out. I searched on the
forum and found that switching over to Restlet 2.2 would help. So I did
that. I upgraded my Restlet to 2.2.1. But now my code has stopped working at
precisely this method.

*public synchronized UUID generateUniqueSessionId(String userAtDomain)
{
UUID newSessionId = UUID.randomUUID();
SessionAttributes sessionAttributes = new SessionAttributes();
sessionAttributes.setAlive(true);
sessionAttributes.setFQUserName(userAtDomain);
loggedInUsers.put(newSessionId, sessionAttributes);
return newSessionId;
}*
So I am returning the UUID at last. This code is on the server and invoked
during login. Following is the error that I am getting from the logs.

*16 Mar 2015 11:23:18 WARN - Unable to find a converter for this object :
f3d2edda-443c-454d-856a-fb4e7ed9c535*

And this object referred in the log belongs to java.util.UUID

The code on the client side which invokes the server looks like this.

*public UUID authenticateUser(String username, String passwd) {

try {
String url =
RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
username + "/" + passwd;

Context context = new Context();

Client client = new Client(context, Protocol.HTTP);
ClientHelper helper = new ClientHelper(client);
helper.getHelpedParameters().set("socketConnectTimeoutMs",
"6");

ClientResource cr = new ClientResource(url);
LoginLogoutResource resource =
cr.wrap(LoginLogoutResource.class);
return resource.loginUser();
} catch (ResourceException re) {
if (re.getStatus().isConnectorError()) {
try {
RESTLetWebSvcsFactory.enableFallBackServer();
String url =
RESTLetWebSvcsFactory.getFactoryInstance().getServer_URL() + "login/" +
username + "/" + passwd;
ClientResource cr = new ClientResource(url);
LoginLogoutResource resource =
cr.wrap(LoginLogoutResource.class);
return resource.loginUser();
} catch (ResourceException re1) {
int statusCode = new
RESTLetErrorHandler().handleServerError(re);
if (statusCode != -1) {
throw new UserCRUDException(statusCode);
}
}
} else {
throw new UserCRUDException(new
RESTLetErrorHandler().handleServerError(re));
}
}
return null;
}*
Note: USERCRUDException is my own exception and not one of JAVA

Please help me resolve this problem which probably prevents returning the
UUID from the server and thus my application isn't moving ahead.

Thanks in advance



--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-converter-for-java-util-UUID-tp7579358.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3105559