'peer not authenticated' exception?

0 votes

This is the first time I am using app42. I have downloaded java SDK and opened through STS(IDE). Replaced the keys in UserServiceSample (from com.shephertz.app42.sdk.test) with mine and I debugged it as a java application then I came up with " com.shephertz.app42.paas.sdk.java.App42Exception: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated " Can anyone help me on this, please.

asked Feb 21, 2019 in Java by Nagaraju Jalli (17 points)

2 Answers

0 votes
 
Best answer

Hello!, 

 

    I want to thank Priyanka Singh and App42 Team for the quick reply. The actual reason for my 'peer not authenticated' exception is 'Java version'. I have changed the java version from 'Java 1.6' to 'Java 1.9' and now my problem is solved :) 

answered Feb 22, 2019 by Nagaraju Jalli (17 points)
selected Feb 25, 2019 by Nagaraju Jalli
0 votes

Hello Nagaraju,

Greetings!!!

There might be different reasons behind this issue:

      - Either your API Key & Secret Key is not correct

      - Internet connection is not working properly

      - Or the device time is not correct on which app is running, please check and confirm.

Also, could you please share the complete logs using App42Log.setDebug(trueand the code snippet in which you getting this exception. It will help us to provide better support to you from our end.

 

Regards,

Priyanka Singh

App42 Team

 

 

answered Feb 21, 2019 by anonymous
package com.shephertz.app42.sdk.test;

import com.shephertz.app42.paas.sdk.java.App42BadParameterException;
import com.shephertz.app42.paas.sdk.java.App42Exception;
import com.shephertz.app42.paas.sdk.java.App42SecurityException;
import com.shephertz.app42.paas.sdk.java.ServiceAPI;
import com.shephertz.app42.paas.sdk.java.user.User;
import com.shephertz.app42.paas.sdk.java.user.UserService;


public class UserServiceSample {
   
    /**
     * Main Method To Create App42 User on Cloud
     * @param args
     */
    public static void main(String[] args) {
        createUser();
    }
   
    /**
     * Test Method for creating the User in App42 Cloud.
     */
    public static void createUser() {
       
       
        // Enter your Public Key and Private Key Here in Constructor. You can
        // get it once you will create a app in app42 console
        ServiceAPI sp = new ServiceAPI(" ","");
        // Create Instance of User Service
        UserService userService = sp.buildUserService();

        // create user or call other available method on the user service
        // reference
        try {
            System.out.println("Starting User Creation test");
            User user = userService.createUser("Nick", "Nick@123","nick@shephertz.com");
           
            //Fetch the returned JSON response
            System.out.println(" User Creation Successfull !!! JSON Response is : " + user);
           
            //Using returned User object, user property can be fetched
            //Fetch User name from user object
            System.out.println(" Created User Name is : " + user.getUserName());
        } catch (App42BadParameterException ex) {
            System.out.println("App42BadParameterException ");
            // Exception Caught
            // Check if User already Exist by checking app error code
            if (ex.getAppErrorCode() == 2001) {
                // Do exception Handling for Already created User.
                System.out.println(" User already exist with given user name");
            }
        } catch (App42SecurityException ex) {
            System.out.println("App42SecurityException ");
            // Exception Caught
            // Check for authorization Error due to invalid Public/Private Key
            if (ex.getAppErrorCode() == 1401) {
                // Do exception Handling here
            }
        } catch (App42Exception ex) {
            System.out.println("App42Exception ");
            // Exception Caught due to other Validation
        }

       
   
    }

}
========
The above one is my java class I just run this and checked in 'app42 console' for confirmation of creating the user.  All jars were placed correctly and there are no compile-time errors. But I am getting the exception.

I have copied and pasted my API Key & Secret Key (I have checked them several times).

I am having a good internet connection.

You said  'the device time is not correct on which app is running', but I am not running any app I am just testing it with my java class which I have downloaded from the documentation.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...