I am trying to retrieve text messages from 2016 until now. The code is only 26 lines. Here it is:
import java.lang.*;
import com.twilio.Twilio;
import com.twilio.rest.bulkexports.v1.export.ExportCustomJob;
public class twilio_export {
// Find your Account Sid and Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
public static final String ACCOUNT_SID = "my account SID";
public static final String AUTH_TOKEN = "my auth token";
public static void main(String[] args) {
System.out.println("Twilio Export Starting");
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
ExportCustomJob exportCustomJob = ExportCustomJob.creator(
"Messages",
"my start date",
"my end date",
"Export1")
.setEmail("my email")
.create();
System.out.println(exportCustomJob.getFriendlyName());
}
}
When I run the code (in Eclipse), I am asked to choose a main class. When I choose my main class, I get these errors:
java.lang.ExceptionInInitializerError
at com.twilio.http.TwilioRestClientBuilder.build(TwilioRestClient.java:141)
at com.twilio.Twilio.buildRestClient(Twilio.java:204)
at com.twilio.Twilio.getRestClient(Twilio.java:180)
at com.twilio.base.Creator.create(Creator.java:40)
at twilio_messages.twilio_export.main(twilio_export.java:22)
Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:571)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:596)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:583)
at com.twilio.http.TwilioRestClient.<clinit>(TwilioRestClient.java:28)
...5 more
When I use the class org.apache.logging.log4j.core
as my main class, I get the output null null
.
Additionally, I did input this dependency into the Maven project's pom.xml file (but I'm not sure if I put it in the correct place):
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio</artifactId>
<version>8.5.1</version>
</dependency>
I have tried running this project as a Maven project in Eclipse and as a general project; both provide the same errors.
Does anyone know how I can fix this error, or have you experienced it in the past?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…