vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Failing OSGi Portlets on Liferay CE 7.3.6 GA7 or later #12504

Closed mikke-alekstra closed 2 years ago

mikke-alekstra commented 2 years ago

I did some testing with OSGi Portlets on Liferay 7.

For some reason Liferay CE 7.3.6 GA7 or later failed with error Failed to load the bootstrap javascript: /o/vaadin-x.y.z/VAADIN/vaadinBootstrap.js?v=x.y.z where x.y.z was the Vaadin version in use.

The test portlet was the basic Hello World portlet using Maven vaadin-archetype-liferay-portlet archetype.

Browser cache/history was cleared between each test.

Passed tests: Liferay CE 7.3.3 GA4, Vaadin 8.10-8.14 Liferay CE 7.3.4 GA5, Vaadin 8.10-8.14 Liferay CE 7.3.5 GA6, Vaadin 8.10-8.14

Failed tests: Liferay CE 7.3.6 GA7, Vaadin 8.10-8.14 Liferay CE 7.3.7 GA8, Vaadin 8.10-8.14 Liferay CE 7.4.0 GA1, Vaadin 8.13, 8.14 Liferay CE 7.4.1 GA2, Vaadin 8.13, 8.14 Liferay CE 7.4.2 GA3, Vaadin 8.14 Liferay CE 7.4.3.4 GA4, Vaadin 8.14

Setup: Debian GNU/Linux 10 (buster) OpenJDK 11 Firefox 78.15.0esr Standard Liferay Docker images

TatuLund commented 2 years ago

Thanks for the effort of extensive testing. This is a good starting point.

Did you observe any notable errors or warnings logged in server log?

mikke-alekstra commented 2 years ago

Sorry, forgot to mention this in the original post.

I think the 404 error was the only one I got. Such as: liferay-dev_1 | 2022-01-05 12:18:45.751 WARN [http-nio-8080-exec-4][code_jsp:173] {code="404", msg="ProxyServlet: /vaadin-8.12.4/VAADIN/vaadinBootstrap.js", uri=/o/vaadin-8.12.4/VAADIN/vaadinBootstrap.js}

In addition, with Vaadin 8.14.3 using jsoup-1.14.3 there was a bit strange behaviour when deploying jar-files:

I expected the order of deployment to be:

  1. jsoup-1.14.3.jar
  2. gentyref-1.2.0.vaadin1.jar
  3. gwt-elemental-2.8.2.vaadin2.jar
  4. vaadin-shared-8.14.3.jar
  5. vaadin-server-8.14.3.jar (+ the rest)

After deploying jsoup:

liferay-dev_1  | 2022-01-05 12:46:22.118 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:271] Processing jsoup-1.14.3.jar
liferay-dev_1  | 2022-01-05 12:46:28.387 INFO  [fileinstall-directory-watcher][BundleStartStopLogger:46] STARTED org.jsoup_1.14.3 [1433]

However after deploying vaadin-server:

liferay-dev_1  | 2022-01-05 12:48:22.147 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:271] Processing vaadin-server-8.14.3.jar
liferay-dev_1  | 2022-01-05 12:48:29.177 ERROR [fileinstall-directory-watcher][DirectoryWatcher:1160] Unable to start bundle: file:/opt/liferay/osgi/modules/vaadin-server-8.14.3.jar
liferay-dev_1  | com.liferay.portal.kernel.log.LogSanitizerException: org.osgi.framework.BundleException: Could not resolve module: com.vaadin.server [1437]_  Unresolved requirement: Import-Package: com.vaadin.sass.internal; resolution:="optional"_  Unresolved requirement: Import-Package: org.atmosphere.cache; version="2.4.30.vaadin4"; resolution:="optional"_  Unresolved requirement: Import-Package: org.atmosphere.client; version="2.4.30.vaadin4"; resolution:="optional"_  Unresolved requirement: Import-Package: org.atmosphere.cpr; version="2.4.30.vaadin4"; resolution:="optional"_  Unresolved requirement: Import-Package: org.atmosphere.handler; version="2.4.30.vaadin4"; resolution:="optional"_  Unresolved requirement: Import-Package: org.atmosphere.util; version="2.4.30.vaadin4"; resolution:="optional"_  Unresolved requirement: Import-Package: org.jsoup; version="[1.14.0,2.0.0)"_ [Sanitized]
liferay-dev_1  |    at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi.jar:?]
liferay-dev_1  |    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428) ~[org.eclipse.osgi.jar:?]
liferay-dev_1  |    at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundle(DirectoryWatcher.java:1143) [bundleFile:?]
liferay-dev_1  |    at com.liferay.portal.file.install.internal.DirectoryWatcher._startBundles(DirectoryWatcher.java:1176) [bundleFile:?]
liferay-dev_1  |    at com.liferay.portal.file.install.internal.DirectoryWatcher._process(DirectoryWatcher.java:1038) [bundleFile:?]
liferay-dev_1  |    at com.liferay.portal.file.install.internal.DirectoryWatcher.run(DirectoryWatcher.java:272) [bundleFile:?]

So I removed jsoup: liferay-dev_1 | 2022-01-05 12:50:09.414 INFO [fileinstall-directory-watcher][BundleStartStopLogger:49] STOPPED org.jsoup_1.14.3 [1433] (+ the vaadin-server dependency error)

And re-deployed jsoup:

liferay-dev_1  | 2022-01-05 12:50:43.169 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:271] Processing jsoup-1.14.3.jar
liferay-dev_1  | 2022-01-05 12:50:49.702 INFO  [Refresh Thread: Equinox Container: 4f33cc77-951f-4bc1-855f-faab822c7f7a][BundleStartStopLogger:46] STARTED com.vaadin.server_8.14.3 [1437]
liferay-dev_1  | 2022-01-05 12:50:49.718 INFO  [fileinstall-directory-watcher][BundleStartStopLogger:46] STARTED org.jsoup_1.14.3 [1438]

This did not happen with Vaadin-releases using jsoup-1.11.2.

TatuLund commented 2 years ago

We tried to investigate commit history of Liferay (which is by the way hard) to find anything that would fit, but so-far we did not find anything yet.

mikke-alekstra commented 2 years ago

FYI, attached bundle information for vaadin-shared and vaadin-server. LR7.3.5 (works), LR7.3.6 (does not work).

For LR7.3.6 vaadin-server (does not work) {org.osgi.service.http.context.ServletContextHelper}={service.id=21949, osgi.http.whiteboard.context.name=com.vaadin, service.bundleid=1359, service.scope=bundle, osgi.http.whiteboard.context.path=/vaadin-8.13.3} is missing from the Services in use -list.

LR7.3.5.txt LR7.3.6.txt

johannest commented 2 years ago

I was now able to replicate the issue with Liferay Docker (liferay/portal:7.3.6-ga7) and vaadin-archetype-liferay-portlet. I got the similar error as you: Failed to load the bootstrap javascript: /o/vaadin-8.14.3/VAADIN/vaadinBootstrap.js?v=8.14.3 This took a while since our documentation was already outdated regarding blade client etc. My steps to reproduce:

  1. docker pull liferay/portal:7.3.6-ga7
  2. Create liferay deploy folder locally e.g. "C:\dev\lr\deploy"
  3. docker run -it -p 8080:8080 -p 11311:11311 -v /mnt/c/dev/lr:/mnt/liferay liferay/portal:7.3.6-ga7
  4. Install Liferay workspace to get e.g. blade client
  5. Create project from vaadin-archetype-liferay-portlet
  6. Upgrade projects dependencies: <liferay.kernel.version>9.30.0</liferay.kernel.version>, osgi.core\8.0.0, osgi.annotation\8.0.1, osgi.cmpn\7.0.0
  7. Build the project
  8. Use blade client to install resources mentioned here: https://vaadin.com/docs/v8/framework/portal/portal-osgi/#portal.osgi.portlet The correct syntax is now blade sh install [url] and then blade sh start [bundle id]
  9. Deploy the target/liferay-portlet-v8-1.0.jar to local Liferay deploy folder (e.g. C:\dev\lr\deploy)
johannest commented 2 years ago

Tested this out now with liferay/portal:7.3.6-ga7 and locally built Vaadin 8.16.0. I had some troubles with jsoup-1.14.3.jar bundle: it was importing 1.10.2 version of itself. Got that resolved by modifying its MANIFEST_MF locally: removed all jsoup related Import-Packages. In addition I had to install following additional bundles: shi-core-6.1.4.jar, jna-5.10.0.jar, and jna-platform-5.10.0.jar. Before vaadin-server bundle was able to start. Unfortunately Vaadin portlet still fails when added to a page: same Failed to load the bootstrap alert. I'll try next few newer Liferay images

johannest commented 2 years ago

I was able to get this working with Portal 7.3.7 CE GA8. It still shows the alert right after adding the portlet to page, but portlet works after publish. Used docker.io/liferay/portal 7.3.7-ga8 image with Podman. In portlet project: 9.36.0</liferay.kernel.version> and locally built V8.16.0 from 'master' branch.