when I want to create an instance of my object TransLog
, an InstantiationException
is thrown even though I created a No-Args constructor in the class TransLog
:
Caused by: java.lang.NoSuchMethodException: TransactionLogger$TransLog.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 20 more
@AllArgsConstructor
private class TransLog {
public TransLog() {
}
private int x;
private int y;
}
I create the instance in this way:
TransLog log = (TransLog) clazz.newInstance(); // clazz is TransLog.class
Thanks for your help in advance :)