lundegaard / react-union

⚛️ Collection of tools allowing to React.js applications to run on specific server-side environments such as Content Management Systems (CMS) or Portals.
http://react-union.org/
MIT License
94 stars 13 forks source link

H2 make the content-portlet available into the official Liferay Docker container #435

Open Muzietto opened 5 years ago

Muzietto commented 5 years ago

I am a React developer new to Liferay. I am trying to use your Union project to plug my react apps inside a legacy Liferay portal.

I have built a JAR eu.reactunion.boilerplate.content-portlet-1.0.0.jar following your instructions at https://react-union.org/boilerplates-liferay#7-build-and-deploy-code-classlanguage-texthero-portletcode-module

Now I am trying to make that JAR available to a running Liferay server.

I am using the official Docker container distribution https://hub.docker.com/r/liferay/portal/

My Dockerfile is the following:

FROM liferay/portal:7.2.0-ga1
COPY --chown=liferay:liferay ./deploy /etc/liferay/mount/deploy
EXPOSE 8080

The folder ./deploy on my PC contains the JAR produced by your scripts, which is correctly copied on the container.

As soon as I run the container, I get the following error message:

org.osgi.framework.BundleException: Could not resolve module: eu.reactunion.boilerplate.content-portlet [1072]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet; version="[7.0.0,8.0.0)"_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1264)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1237)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)

My understanding is that Liferay tries to unbundle and launch the JAR, but that dependencies are missing.

Can you please assist me in this issue?

jamescoq commented 5 years ago

Hi @Muzietto. Your jar containing the portlet is probably referencing a different version of liferay dependencies (like com.liferay.portal.kernel.portlet and possibly others) then are available in your running liferay instance. Try upgrading com.liferay.gradle.plugins in settings.gradle in https://github.com/lundegaard/react-union/tree/master/boilerplates/react-union-boilerplate-liferay-basic.

Muzietto commented 5 years ago

Hello @jamescoq.

I am using the official liferay 7.2 docker container and the Union boilerplates that are explicitly prepared for 7.2, so my assumption is that everything should be in sync.

Anyhow we followed your suggestions by modifying from 2.0.0 to 4.32.0 the version of com.liferay.portal.kernel inside dependencies.gradle (I assume you meant that file, because I could not find anything relevant in settings.gradle).

The error message is now:

Unresolved requirement: Import-Package: com.liferay.portal.kernel.theme; version="[2.1.0,3.0.0)"

We are quite puzzled, because we overcame the error message about com.liferay.portal.kernel.portlet and now we get an error message about com.liferay.portal.kernel.theme which (AFAIU) should be part of the same dependency.

Can you please shed some light about all this?

And, more important:

Have you tried your boilerplate 7.2 with the official liferay 7.2 docker container? I reckon you would have encountered the same issues we are facing.