java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException
java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException
我尝试按照 Twilio 教程 here 通过 Java 代码发送短信,但我在 行收到 java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException
13 在我写 Service service = Service.creator("My First Messaging Service").create();
的代码中
我尝试关注此线程并添加了所有必需的依赖项,但我不知道在代码中的何处使用@JsonIgnore
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException$Reference
我该如何解决这个问题?请帮我解决这个问题。
这是我的 java 代码
import com.twilio.Twilio;
import com.twilio.rest.messaging.v1.Service;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.core.*;
public class SMSOTP
{
public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");
public static void main(String[] args)
{
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Service service = Service.creator("My First Messaging Service").create();
System.out.println(service.getSid());
}
}
对于任何来这里寻找解决方案的人来说,这都是一个严重的依赖问题。我有 3 个杰克逊 API(注释、数据绑定和核心)手动添加到我的项目中,这就是问题所在。它实际上需要更多。
所以我所做的是按照 Convert Existing Eclipse Project to Maven Project and in pom.xml, in <builds>
i copy pasted all the <plugins>
that twilio required to work from here https://github.com/twilio/twilio-java/blob/main/pom.xml
切换到 Maven 项目
感谢@MichałZiober 的建议,最终成功了。
希望这可以帮助任何人从挠头几个小时:)祝你好运!
我尝试按照 Twilio 教程 here 通过 Java 代码发送短信,但我在 行收到 java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException
13 在我写 Service service = Service.creator("My First Messaging Service").create();
我尝试关注此线程并添加了所有必需的依赖项,但我不知道在代码中的何处使用@JsonIgnore Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException$Reference
我该如何解决这个问题?请帮我解决这个问题。 这是我的 java 代码
import com.twilio.Twilio;
import com.twilio.rest.messaging.v1.Service;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.core.*;
public class SMSOTP
{
public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");
public static void main(String[] args)
{
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Service service = Service.creator("My First Messaging Service").create();
System.out.println(service.getSid());
}
}
对于任何来这里寻找解决方案的人来说,这都是一个严重的依赖问题。我有 3 个杰克逊 API(注释、数据绑定和核心)手动添加到我的项目中,这就是问题所在。它实际上需要更多。
所以我所做的是按照 Convert Existing Eclipse Project to Maven Project and in pom.xml, in <builds>
i copy pasted all the <plugins>
that twilio required to work from here https://github.com/twilio/twilio-java/blob/main/pom.xml
感谢@MichałZiober 的建议,最终成功了。
希望这可以帮助任何人从挠头几个小时:)祝你好运!