Foros de discusión
Liferay Spring Object Initialization NPE
Sourabh Lonikar, modificado hace 7 años.
Liferay Spring Object Initialization NPE
Junior Member Mensajes: 42 Fecha de incorporación: 14/11/16 Mensajes recientes
Hi all,
I am getting below NPE @ this code location.
It seems class variable dlFileVersionPersistence is null. Can someone point out how to find out if it has been properly initialized through spring.xml ?
** Liferay Code **
Method Paramters:
fileEntryId : 21403
excludeWorkingCopy : true
public DLFileVersion getLatestFileVersion(long fileEntryId, boolean excludeWorkingCopy) throws PortalException, SystemException {
List<DLFileVersion> dlFileVersions = dlFileVersionPersistence.findByFileEntryId(fileEntryId);
if (dlFileVersions.isEmpty()) {
throw new NoSuchFileVersionException(
"No file versions found for fileEntryId " + fileEntryId);
}
...
...
}
** Liferay Error **
11:09:21,554 INFO [Tagger:151] addName | DLFileVersionLocalServiceImpl : getMethod :: FileEntryId : 21403
11:09:21,555 INFO [Tagger:154] addName | DLFileVersionLocalServiceImpl : invoke
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
Caused by: java.lang.NullPointerException
at com.liferay.portlet.documentlibrary.service.impl.DLFileVersionLocalServiceImpl.getLatestFileVersion(DLFileVersionLocalServiceImpl.java:99)
... 200 more
Regards,
Sourabh
I am getting below NPE @ this code location.
It seems class variable dlFileVersionPersistence is null. Can someone point out how to find out if it has been properly initialized through spring.xml ?
** Liferay Code **
Method Paramters:
fileEntryId : 21403
excludeWorkingCopy : true
public DLFileVersion getLatestFileVersion(long fileEntryId, boolean excludeWorkingCopy) throws PortalException, SystemException {
List<DLFileVersion> dlFileVersions = dlFileVersionPersistence.findByFileEntryId(fileEntryId);
if (dlFileVersions.isEmpty()) {
throw new NoSuchFileVersionException(
"No file versions found for fileEntryId " + fileEntryId);
}
...
...
}
** Liferay Error **
11:09:21,554 INFO [Tagger:151] addName | DLFileVersionLocalServiceImpl : getMethod :: FileEntryId : 21403
11:09:21,555 INFO [Tagger:154] addName | DLFileVersionLocalServiceImpl : invoke
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
Caused by: java.lang.NullPointerException
at com.liferay.portlet.documentlibrary.service.impl.DLFileVersionLocalServiceImpl.getLatestFileVersion(DLFileVersionLocalServiceImpl.java:99)
... 200 more
Regards,
Sourabh
Jorge Díaz, modificado hace 7 años.
RE: Liferay Spring Object Initialization NPE
Liferay Master Mensajes: 753 Fecha de incorporación: 9/01/14 Mensajes recientes
Which Liferay version are you using?
The error is produced in getLatestFileVersion. Are you calling it from a custom code written by you or error is produced in Liferay without any customization?
You can also try using last GA version available.
The error is produced in getLatestFileVersion. Are you calling it from a custom code written by you or error is produced in Liferay without any customization?
You can also try using last GA version available.
Sourabh Lonikar, modificado hace 7 años.
RE: Liferay Spring Object Initialization NPE
Junior Member Mensajes: 42 Fecha de incorporación: 14/11/16 Mensajes recientes
Hi Jorge,
Sorry for delay in my response.
I am using Liferay Portal 6.2 EE SP15 with Tomcat 7.0.62. This error is thrown when my Custom portlet calls DLFileVersionLocalServiceImpl.getLatestFileVersion() function. The error stack track shows NPE occuring within Liferay code with method parameters not being null.
Regards,
Sourabh
Sorry for delay in my response.
I am using Liferay Portal 6.2 EE SP15 with Tomcat 7.0.62. This error is thrown when my Custom portlet calls DLFileVersionLocalServiceImpl.getLatestFileVersion() function. The error stack track shows NPE occuring within Liferay code with method parameters not being null.
Regards,
Sourabh