Forums de discussion
Liferay 7 - Export / Import - DLFileEntryImpl cannot be cast to DLFileEntry
Benjamin Bini, modifié il y a 7 années.
Liferay 7 - Export / Import - DLFileEntryImpl cannot be cast to DLFileEntry
Junior Member Publications: 31 Date d'inscription: 24/05/13 Publications récentes
Hello,
I am implementing export / import / staging to my application.
In my stagedModelDataHandler, I want to export references to a DLFileEntry. Here is what I do :
Where stagedModel.getImageId() returns a DLFileEntry.
The problem is that I got this error when trying to export :
When I look at how export is implemented in Liferay code base, it seems to be done the same way than me.
What can I do to fix it?
Thank you very much!
I am implementing export / import / staging to my application.
In my stagedModelDataHandler, I want to export references to a DLFileEntry. Here is what I do :
StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, stagedModel, stagedModel.getImageId(), PortletDataContext.REFERENCE_TYPE_WEAK);
Where stagedModel.getImageId() returns a DLFileEntry.
The problem is that I got this error when trying to export :
ERROR [liferay/background_task-1][BackgroundTaskMessageListener:164] Unable to execute background task
com.liferay.exportimport.kernel.lar.PortletDataException: java.lang.ClassCastException: com.liferay.portlet.documentlibrary.model.impl.DLFileEntryImpl cannot be cast to com.liferay.portal.kernel.repository.model.FileEntry
When I look at how export is implemented in Liferay code base, it seems to be done the same way than me.
What can I do to fix it?
Thank you very much!
Jorge Díaz, modifié il y a 7 années.
RE: Liferay 7 - Export / Import - DLFileEntryImpl cannot be cast to DLFileE
Liferay Master Publications: 753 Date d'inscription: 09/01/14 Publications récentes
Hi Benjamin,
Please paste the full stacktrace about the "java.lang.ClassCastException"
In some Document Library code the DLFileEntry objects are wrapped inside a com.liferay.portal.kernel.repository.model.FileEntry, perhaps you have to do something related to this.
Please paste the full stacktrace about the "java.lang.ClassCastException"
In some Document Library code the DLFileEntry objects are wrapped inside a com.liferay.portal.kernel.repository.model.FileEntry, perhaps you have to do something related to this.
Olaf Kock, modifié il y a 7 années.
RE: Liferay 7 - Export / Import - DLFileEntryImpl cannot be cast to DLFileE
Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentesBenjamin Bini:
... com.liferay.portlet.documentlibrary.model.impl.DLFileEntryImpl cannot be cast to com.liferay.portal.kernel.repository.model.FileEntry...
Whenever there's an object that cannot be typecasted to its legitimate supertype, you have a duplicate class (most likely the interface) on your classpath. When there are multiple FileEntry classes loaded, the error message doesn't give an indicator which one is in use and which one is tried for the typecast.
Benjamin Bini, modifié il y a 7 années.
RE: Liferay 7 - Export / Import - DLFileEntryImpl cannot be cast to DLFileE
Junior Member Publications: 31 Date d'inscription: 24/05/13 Publications récentes
Thank you. I should have updated the thread: the problem was solved after a server restart. A lot of problems with staging/export/import are actually solved by server restarts. Hot deploy is bad
Thank you for your answers
Thank you for your answers