Search code examples
liferayliferay-7liferay-ide

Writing first Liferay application: how to deploy module to server + error: A full JDK (not just JRE) is required


I'm following Liferay getting-started example to develop my first we app with Liferay IDE in which it is mentioned:

Even though all you’ve done is generate it, the guestbook-web project is ready to be built and deployed to Liferay DXP. Make sure that your server is running, and if it isn’t, select it in Developer Studio’s Servers pane and click the start button. After it starts, drag and drop the guestbook-web project from the Project Explorer to the server.

I started the server, however, I don't know how to deploy guestbook-web module to server. Drag and drop is not working for me:

Liferay IDE Screenshot

When Opening the web page, this is shown which doesn't contain anything related to guestbook-web module:

Web page screenshot


Update

When I drag and drop my module on server, for some reason it is not allowed:

Drag and drop is forbidden


Update

Also, I'm receiving such errors on console:

22-Apr-2020 16:02:54.419 SEVERE [http-nio-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Module Framework Servlet] in context with path [] threw exception [PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required] with root cause
 org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required

I have set both JDK and JRE path for IDE, not sure why it says A full JDK (not just JRE) is required.


Update

To fix A full JDK (not just JRE) is required error, inspired by this answer, I ran the IDE with this command:

C:\Program Files (x86)\LiferayWorkspacewithDevStudioCommunityEdition\liferay-developer-studio>DeveloperStudio.exe -vm "C:\Program Files\Java\jdk1.8.0_251\bin\javaw.exe"

The error is resolved and default widgets are fine now:

Widgets are fine now


Solution

  • In the IDE: You'll drag the "guestbook-web" with the mouse and drop it right on the highlighted "Liferay 7.x at localhost" Server (Note: on, not below).

    Outside of the IDE: Your project generates a jar, and you can copy that to Liferay's deploy directory.

    Once the module is deployed, it won't magically show up on the page: Log in as Administrator, choose the "Add" button (a plus sign) and add a "widget" to the page: In the list of Widgets you'll find your new portlet/widget.

    The screenshot of your installation looks weird though, as if something didn't go wrong and you'll likely need to look for signs of problems in the log file to see why Liferay ends up in the state that it's in, with a couple of default widgets being unavailable - however, that's unrelated to the question how to deploy new code to the runtime.

    Edit: You've mentioned the required JDK from the log. That's good to be fixed.

    With regards to the not-working drag&drop: It looks like you're using Liferay Workspace. From the icons in Project Explorer, it looks like your module isn't recognized as such: Try to "Gradle/Refresh Gradle Project" (right-click on "modules") to see if it needs some updates that are missing (and observe its log output). Icons on my IDE look like this:

    illustration for module icons

    Once you get those modules recognized, you should be able to drag&drop them to the server.