Class cast exception in API

Hi. I’m trying to make a custom API for creating documents. I’m following the example, but getting ClassCastException with the wpm.createObject() method.

HippoDocument hippoDocument = (HippoDocument) wpm.getObject(beanPath); //works
EventDocument eventDocumentBean = (EventDocument) wpm.getObject(beanPath); //doesn't work
java.lang.ClassCastException: class org.hippoecm.hst.content.beans.standard.HippoDocument$EventDocument$4vkQoxwy cannot be cast to class org.sae.cm.modules.document.EventDocument (org.hippoecm.hst.content.beans.standard.HippoDocument$EventDocument$4vkQoxwy and org.sae.cm.modules.document.EventDocument are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @3bb44eac)

Any ideas?

Thank you.

I would guess you have different EventDocument classes in your project. If not, could you share the EventDocument class?

@Joshua_Glickman is this the same with Help creating document in API ?
If so could you please keep one active? Thanks in advance!

Ps. It would be better if you delete this one as this is the Content SaaS section and your question relates to PaaS