Message Boards

dependency issue on reading xlsx file in Liferay 7.3

thumbnail
Shiva Lingam K, modified 2 Years ago.

dependency issue on reading xlsx file in Liferay 7.3

New Member Posts: 18 Join Date: 5/9/18 Recent Posts

Hi,

I am using Liferay 7.3 DXP, while reading xlsx file i am getting dependency issue.Provided below the more details.

My code:

XSSFWorkbook wb = new XSSFWorkbook(xlsFile);
XSSFSheet sheet = wb.getSheetAt(0);
 XSSFRow row;

Build.gradle file:

                compileOnly  group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
Exception:

        org.osgi.framework.BundleException: Could not resolve module: com.test [1659]_  Unresolved requirement: Import-Package: org.apache.poi.ss.usermodel_ [Sanitized]
        at org.eclipse.osgi.container.Module.start(Module.java:444)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
        at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundle(DirectoryWatcher.java:1119)
        at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundles(DirectoryWatcher.java:1152)
        at com.liferay.portal.file.install.internal.DirectoryWatcher._process(DirectoryWatcher.java:1014)
        at com.liferay.portal.file.install.internal.DirectoryWatcher.run(DirectoryWatcher.java:265)

 

 

Can any one help me in resolving this issue.

thumbnail
Olaf Kock, modified 2 Years ago.

RE: dependency issue on reading xlsx file in Liferay 7.3

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

You can compile the code, based on your compiler dependencies. But at runtime, you'll also need to provide poi (and its transitive dependencies).

If poi is distributed as OSGi-bundle: deploy it as well.

If it isn't, you might want to check if somebody did that work for you and has an alternative distribution to Apache's, file an issue with the POI project to include the metadata in their releases, or use compileInclude (but remember to also bring in the transitive dependencies)

There's a chapter on this on Liferay University's "OSGi basics" course by yours truly.