2013-12-02

I'm trying to add images programmatically to liferay Documents Library.
I'm using liferay portal 6.1.30 ee.

Here is my code:

I try using DLFileEntryLocalServiceUtil.addFileEntry but it doesn't create my documents properly, as I red in this post no assetEntry record is created.

So I tried DLFileEntryLocalServiceUtil.updateStatus (commented here) but i got this error, still no assetEntry:

com.liferay.portlet.asset.NoSuchEntryException: No AssetEntry exists
with the key {classNameId=10076, classPK=42954}
at
com.liferay.portlet.asset.service.persistence.AssetEntryPersistenceImpl.findByC_C(AssetEntryPersistenceImpl.java:2933)

at sun.reflect.GeneratedMethodAccessor1937.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.liferay.portal.security.lang.DoPrivilegedHandler.doInvoke(DoPrivilegedHandler.java:88)

at
com.liferay.portal.security.lang.DoPrivilegedHandler.invoke(DoPrivilegedHandler.java:56)

at com.sun.proxy.$Proxy689.findByC_C(Unknown Source)

at
com.liferay.portlet.asset.service.impl.AssetEntryLocalServiceImpl.updateVisible(AssetEntryLocalServiceImpl.java:866)

at sun.reflect.GeneratedMethodAccessor1936.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:117)

at
com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)

at
com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:52)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:218)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.doInvoke(PACLInvocationHandler.java:62)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.invoke(PACLInvocationHandler.java:51)

at com.sun.proxy.$Proxy394.updateVisible(Unknown Source)

at
com.liferay.portlet.documentlibrary.service.impl.DLAppHelperLocalServiceImpl.updateStatus(DLAppHelperLocalServiceImpl.java:584)

at sun.reflect.GeneratedMethodAccessor1935.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:117)

at
com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)

at
com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:52)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:218)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.doInvoke(PACLInvocationHandler.java:62)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.invoke(PACLInvocationHandler.java:51)

at com.sun.proxy.$Proxy466.updateStatus(Unknown Source)

at
com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.updateStatus(DLFileEntryLocalServiceImpl.java:1298)

at
com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceWrapper.updateStatus(DLFileEntryLocalServiceWrapper.java:624)

at sun.reflect.GeneratedMethodAccessor1933.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)

at com.sun.proxy.$Proxy782.updateStatus(Unknown Source)

at sun.reflect.GeneratedMethodAccessor1933.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:117)

at
com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)

at
com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:52)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)

at
com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:113)

at
com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:218)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.doInvoke(PACLInvocationHandler.java:62)

at
com.liferay.portal.security.pacl.PACLInvocationHandler.invoke(PACLInvocationHandler.java:51)

at com.sun.proxy.$Proxy468.updateStatus(Unknown Source)

at
com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil.updateStatus(DLFileEntryLocalServiceUtil.java:626)

at xxx.addDocument()

and i tried calling methods DLFileEntryLocalServiceUtil.updateDLFileEntry or updateFileEntry
but it make no difference

Show more