vaadin / portlet

Portlet support for Vaadin Flow
https://vaadin.com
Other
2 stars 3 forks source link

LicenseChecker 1.2.1 is not compatible with Liferay 7.3+ #192

Closed mshabarov closed 2 years ago

mshabarov commented 2 years ago
mshabarov commented 2 years ago

On my machine it fails with com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/sun/jna/platform/mac/IOKit$IORegistryEntry just after adding the portlet to the page.

Liferay 7.3+ uses net.java.dev.jna:jna of version 4.1.0 whereas the Vaadin license checker uses 5.8.0 (via oshi-core), which causes NoClassDefFoundError because the used in LC methods/classes are not present in the older version.

Possible solution is to configure third-party jna dependency in Liferay to be more recent, as described here https://help.liferay.com/hc/en-us/articles/360017878032-Configuring-Dependencies and here https://help.liferay.com/hc/en-us/articles/360018162491-Resolving-Third-Party-Library-Package-Dependencies-

mshabarov commented 2 years ago

Works with license checker version 1.2.0 (included in v14.8.0) and v14.8.0, no errors on my side when running with Liferay 7.3.7-ga8.

UPD: re-tried with version 1.2.1 and got no errors. I run the liferay in docker and this time set the pro license key through the system property in setenv file. So the previous error was probably related to pro license file, not dependency conflict, because I didn't set up the license when error came.

mshabarov commented 2 years ago

Now I'm able to reproduce the issue. Indeed, when running in dev mode and being added to the page, the portlet throws an exception. No exception in production mode.

Solution: copy net.java.dev.jna:jna:5.7.0 and net.java.dev.jna:jna-platform:5.7.0 to {liferay.home}/tomcat-{version}/webapps/ROOT/WEB-INF/lib/ in order to force Liferay use the version you want. Note that the file name should differ from the existing file jna.jar, for example jna-5.7.0.jar.

Download: https://mvnrepository.com/artifact/net.java.dev.jna/jna/5.7.0 https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform/5.7.0

Liferay Docs: https://learn.liferay.com/dxp/latest/en/building-applications/reference/jars-excluded-from-wabs.html