I have a listener program that triggers a main program based on the below conditions
- If the database has new records
- If the time from last run is 10 minutes.
This is done using ScheduledExecutorService
of Java (https://stackoverflow.com/a/26043250/1930402 helped out).
So, I am calling a perfectly working program from this Listener, located in another Project and another Folder. That is, I am calling project B from project A. To enable this, I added a dependency of Project B in Project A's POM.xml
.
There is an error in one of the classes of Project B, and it is NoSuchMethodError
. I can see the method right there. From the answers of this post, https://stackoverflow.com/a/24902026/1930402, I understand that this particular class might not be there in my build path. I am not sure of this.
Can anyone advise?
Note: Project B runs without any issues when it is run independently.
Java Doc tells:
"Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed."
How can the definition of my class change while running using a static instance?
This is my stack:
java.lang.NoSuchMethodError:a.b.c.StringUtils.formatDateToString(Ljava/lang/Object;)Ljava/lang/String;
So, these are the key points: Maven Dependency, ScheduledExecutorService
, Static Class.