从命令行部署 App Engine 标准项目时出错
我们有一个 App Engine 标准 Java8 项目,其中 JSP 文件用于视图,并且每个 jsp 文件都将使用 util 类,因此我们使用 jsp 提供的 page 指令来导入所需的 util 类。代码如下所示
<%@page import="util.AssetUtils"%>
。
我们在任何 JSP 中都没有出现任何错误,甚至在使用 Google Cloud Tools for Eclipse
插件完成部署时都没有问题。
但是当我们尝试使用命令行部署时。对于某些 jsp 文件,我们收到以下错误。
INFO: Built File: /includes/social-ad-template.jsp
Mar 02, 2022 2:59:38 PM org.apache.jasper.JspC execute
INFO: Generation completed with [0] errors in [926] milliseconds
warning: [options] bootstrap class path not set in conjunction with -source 8
/var/folders/nn/_v6wc4tn02x45jp9f_5ysrch0000gp/T/1646213377265-0/org/apache/jsp/includes/scripts_002dto_002dinject_002din_002dhead_jsp.java:15: error: package util does not exist
import util.AssetsUtil;
^
/var/folders/nn/_v6wc4tn02x45jp9f_5ysrch0000gp/T/1646213377265-0/org/apache/jsp/includes/scripts_002dto_002dinject_002din_002dbody_jsp.java:14: error: package util does not exist
import util.ModeUtil;
Gcloud 版本
Google Cloud SDK 375.0.0
app-engine-java 1.9.95
app-engine-python 1.9.99
bq 2.0.74
cloud-datastore-emulator 2.1.0
core 2022.02.25
gsutil 5.6
有人可以帮忙吗?
谢谢!
We have a App Engine standard Java8 project, where JSP files were used for views and each of those jsp file will be using a util class, so we've used the page directive provided by jsp to import the required util class. The code looks like below
<%@page import="util.AssetUtils"%>
.
We don't have any error in any of those JSPs' and even the deployment was fine when done with Google Cloud Tools for Eclipse
plugin.
But when we tried deployment with command line. We are getting the below error for some of the jsp files.
INFO: Built File: /includes/social-ad-template.jsp
Mar 02, 2022 2:59:38 PM org.apache.jasper.JspC execute
INFO: Generation completed with [0] errors in [926] milliseconds
warning: [options] bootstrap class path not set in conjunction with -source 8
/var/folders/nn/_v6wc4tn02x45jp9f_5ysrch0000gp/T/1646213377265-0/org/apache/jsp/includes/scripts_002dto_002dinject_002din_002dhead_jsp.java:15: error: package util does not exist
import util.AssetsUtil;
^
/var/folders/nn/_v6wc4tn02x45jp9f_5ysrch0000gp/T/1646213377265-0/org/apache/jsp/includes/scripts_002dto_002dinject_002din_002dbody_jsp.java:14: error: package util does not exist
import util.ModeUtil;
Gcloud version
Google Cloud SDK 375.0.0
app-engine-java 1.9.95
app-engine-python 1.9.99
bq 2.0.74
cloud-datastore-emulator 2.1.0
core 2022.02.25
gsutil 5.6
Can someone please help with this ?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在 Google Cloud Tools for Eclipse 插件中运行此程序时不会出现错误,因为它会为您下载所需的依赖项。要使用 javac 命令在 CLI 中运行它,您需要指定 CLASSPATH。位于 /home/user 目录内部非常重要。
OP 确认他遵循了上述建议,并将类路径中的输出路径位置更改为指向 WebContent 文件夹内的目录。现在类文件在部署期间可用并且工作正常。
I think there is no error while running this in Google Cloud Tools for Eclipse plugin because it downloads required dependencies for you. To run it in CLI using the javac command, you need to specify CLASSPATH. It is important to be inside of the /home/user directory.
OP confirmed that he followed the above suggestion and changed the output path location in the classpath to point a dir inside his WebContent folder. So now the class files are available during the deployment and it is working fine.