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

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

我正在关注 Liferay 入门 example 以使用 Liferay IDE 开发我的第一个应用程序,其中提到:

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.

我启动了服务器,但是,我不知道如何将 guestbook-web 模块部署到服务器。拖放 对我有用:

打开网页时,显示不包含任何与 guestbook-web 模块相关的内容:


更新

当我将我的模块拖放到服务器上时,出于某种原因不允许:


更新

此外,我在控制台上收到此类错误:

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

我已经为 IDE 设置了 JDK 和 JRE 路径,不知道为什么它说 A full JDK (not just JRE) is required.


更新

为了修复 A full JDK (not just JRE) is required 错误,受 this answer 启发,我 运行 IDE 使用此命令:

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

错误已解决,默认小部件现在可以正常使用了:

在 IDE 中:您将使用鼠标拖动 "guestbook-web" 并将其右 放在 突出显示的 "Liferay 7.x at localhost" 服务器上(注:不低于).

在 IDE 之外:您的项目生成一个 jar,您可以将其复制到 Liferay 的 deploy 目录。

部署模块后,它不会神奇地显示在页面上:以管理员身份登录,选择 "Add" 按钮(加号)并添加 "widget"页面:在小部件列表中,您会找到新的 portlet/widget.

不过,您的安装屏幕截图看起来很奇怪,就好像没有出现问题一样,您可能需要在日志文件中查找问题的迹象,以了解为什么 Liferay 最终处于它所处的状态,有几个默认小部件不可用 - 但是,这与如何将新代码部署到运行时的问题无关。

编辑: 您已经从日志中提到了必需的 JDK。能修好就好了。

关于无效的拖放操作:看起来您正在使用 Liferay Workspace。从 Project Explorer 中的图标来看,您的模块似乎未被识别为:尝试 "Gradle/Refresh Gradle Project"(右键单击 "modules")以查看它是否需要一些缺失的更新(并观察它的日志输出)。我的 IDE 上的图标如下所示:

识别出这些模块后,您应该能够将它们拖放到服务器上。

我意识到要避免 A full JDK (not just JRE) is required 错误,需要在使用 GUI 创建服务器时正确设置服务器: