java.lang.NoSuchFieldError:USE_DEFAULTS

时间:2017-11-11 23:32:23

标签: java twilio twilio-api

因此,在编写和测试twilio的试用代码(Java)时,发送SMS iam会出现上述错误。这是下面的代码:

Exception in thread "main" java.lang.NoSuchFieldError: USE_DEFAULTS
    at com.fasterxml.jackson.annotation.JsonInclude$Value.<clinit>(JsonInclude.java:247)
    at com.fasterxml.jackson.databind.cfg.ConfigOverrides.<init>(ConfigOverrides.java:53)
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:564)
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:480)
    at com.twilio.http.TwilioRestClient.<init>(TwilioRestClient.java:31)
    at com.twilio.http.TwilioRestClient.<init>(TwilioRestClient.java:6)
    at com.twilio.http.TwilioRestClient$Builder.build(TwilioRestClient.java:104)
    at com.twilio.Twilio.getRestClient(Twilio.java:122)
    at com.twilio.base.Creator.create(Creator.java:45)
    at sms.Sms.main(Sms.java:17)

异常堆栈跟踪: -

#include <fstream>
#include <iostream>
#include <string>
using namespace std;

class Book {
public:
    friend ostream& operator<< (ostream& out, Book* book) {
        out << book->title_;
        return out;
    }
    friend istream& operator>> (istream& in, Book* & book) {
        getline(in, book->title_);
        return in;
    }
    Book* setNext(Book* book) {
        nextPtr_ = book;
    return nextPtr_;
    }
    Book() : nextPtr_(NULL) {}
    string getTitle() {
        return title_;
    }

    Book* nextPtr_;
private:
    string title_;
};


int main() {
    ifstream inputFile;
    Book *head;

    inputFile.open("titles.txt");

    // Creates head
    head = new Book();
    inputFile >> head;

    Book* temp = head;
    Book* newe;
    for (int i = 0; i < 2; i++) {
        inputFile >> newe;
        cout << newe->getTitle();
        temp->setNext(newe);
        temp = temp->nextPtr_;
    }
    /*
    for (int i = 0; i < 2; i++) {
        cout << head << endl;
        temp = head->nextPtr_;
    }*/


    system("PAUSE");
    return 0;
}

1 个答案:

答案 0 :(得分:1)

Twilio开发者传道者在这里。

Twilio Java library可以在没有maven的情况下使用,您只需要确保拥有正确的依赖关系。文档列出了two ways of using the jar without a build tool

You can either download a jar with the dependencies included, called twilio-7.x.x-with-dependencies.jar, from the maven repo

或者,您可以downloading twilio-7.x.x.jar获取the dependencies which are listed in the projects pom.xml file并获取logging mechanism

让我知道这是否有帮助。