Twillio SDK, exactly the create()
method, seems to depend on Jackson (FasterXML converter library), particularly its module for handling Java8 DateTime (JSR-310). This is obvious when a call of create()
results in a NoSuchMethod...
for a missing method of class JSR310DateTimeDeserializerBase
.
If you would have included the complete error output such as the stack-trace of this exception, then we could have easily seen that.
Analysis
ℹ️ A NoSuchMethod
runtime-error is usually not caused by import
statements or web.xml
. It usually correlates with mismatching dependency-versions.
See the Twilio Java SDK v 8.9.0 (jar) as shown in Maven's web-UI (same as v 8.8.0) includes pom.xml
with following dependency:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>?
and under the properties the required version:
<jackson.version>2.12.1</jackson.version>
Check dependency versions
Make sure that this jar or package is included within the Twillio jar or at least on your classpath.
⚠️ Also the versions must match (e.g. jackson-core v1 is often depending on jackson-datatype v1). A newer or older version may either change the method (currently not found) i.e. the call or the method-declaration.
Did the method change in Jackson versions?
In previous version (2.11) I also found the method findFormatOverrides
with expected signature (parameters and return types) in class JSR310DateTimeDeserializerBase
.
It was called inside the JsonDeserializer for a Java date-time property. Here when the deserializer is created in context, the parent-class' method is called:
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException {
JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType());
Solving suggestions
See How do I fix a NoSuchMethodError?. A comment to that question fits yours:
In Netbeans: Right click on project in Projects tab, use "Clean and Build". Solved it for me.
This article on NoSuchMethod is very helpful for this issue.
Use Gradle or Maven
You should consider to use a dependency-management and build-automation tool like Maven or Gradle: