Unable to find converter for java.util.UUID

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unable to find converter for java.util.UUID

jayturakhia
This post has NOT been accepted by the mailing list yet.
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 timedout. 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) {
                logger
                                .debug("SystemCache.generateUniqueSessionId invoked with userId = "
                                                + userAtDomain);
                UUID newSessionId = UUID.randomUUID();
                SessionAttributes sessionAttributes = new SessionAttributes();
                sessionAttributes.setAlive(true);
                sessionAttributes.setFQUserName(userAtDomain);
                loggedInUsers.put(newSessionId, sessionAttributes);
                logger.debug("SystemCache.generateUniqueSessionId # of users logged in = {}",loggedInUsers.size());
                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 belongs to java.util.UUID

The code on the client side looks like this.

        @Override
        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", "60000");

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



Please help me resolve this problem.

Thanks in advance