News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
ringcentral java sdk RestClient authorize throws null pointer exception
Tags: rest api
Nov 26, 2019 at 2:02pm   •   3 replies  •  0 likes
Samir Patel

Running following code on tomcat throws null pointer exception. Running same code in java main method runs fine.

        RestClient rc = new RestClient(clientID, clientSecret, serverURL);
        System.out.println("server-> " + rc.server);
        try {
            rc.authorize(username, extension, password);
            GetVersionsResponse result = rc.restapi().list();
            System.out.println("Result " + result.uri);
            rc.revoke();
        }
        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch (RestException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


java.lang.NullPointerException

at com.ringcentral.RestClient.requestRaw(RestClient.java:257)

at com.ringcentral.RestClient.request(RestClient.java:320)

at com.ringcentral.RestClient.request(RestClient.java:251)

at com.ringcentral.RestClient.post(RestClient.java:146)

at com.ringcentral.paths.restapi.oauth.token.Index.post(Index.kt:18)

at com.ringcentral.RestClient.authorize(RestClient.java:113)

3 Answers
answered on Nov 27, 2019 at 8:19am  

It looks like something is wrong in your project settings that did not import the RingCentral SDK properly. I don't see this line printed in your post:

System.out.println("server-> " + rc.server);

Can you double check or show how you import the SDK?


 0
answered on Nov 27, 2019 at 8:06am  

HI, Ideally you should not get the null pointer. How you are loading ring central dependencies ? If you are using maven or gradle then try to use latest version jars.


 0
answered on Nov 27, 2019 at 10:34am  

Sorry thanks for your input. I figured out.


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us