留言板

Liferay Spring Object Initialization NPE

Sourabh Lonikar,修改在7 年前。

Liferay Spring Object Initialization NPE

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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
thumbnail
Jorge Díaz,修改在7 年前。

RE: Liferay Spring Object Initialization NPE

Liferay Master 帖子: 753 加入日期: 14-1-9 最近的帖子
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.
Sourabh Lonikar,修改在7 年前。

RE: Liferay Spring Object Initialization NPE

Junior Member 帖子: 42 加入日期: 16-11-14 最近的帖子
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