Resin上的错误Java版本

huangapple go评论74阅读模式
英文:

Wrong Java version on Resin

问题

在我们的项目中,我们使用Resin作为生产服务器。在我的本地机器上,我之前使用的是Jetty,但在不同的服务器上,我遇到了一些应用程序行为上的差异。这就是为什么我正在尝试添加配置到Intellij IDEA,以便将Resin作为应用服务器使用。

当我尝试运行它时,我遇到了以下错误:

[20-09-03 16:35:39.134] {resin-port-80-49} 警告: [options] 未设置引导类路径,与 -source 1.5 一起使用
                       警告: [options] 源值 1.5 已过时,将在未来的版本中删除
                       警告: [options] 要抑制有关已过时的选项的警告,请使用 -Xlint:-options。
                       /include/header.jsp:70: 错误: 不支持 -source 1.5 中的 diamond 运算符
                                 List<String> jsEncodedItems = new ArrayList<>(list.size());
                                                                             ^
                         (请使用 -source 7 或更高版本以启用 diamond 运算符)
                       1 个错误
                       3 个警告

我已经在“项目结构”中检查了Java版本,并在Maven的pom.xml文件中也找到了1.8版本。与此同时,使用Jetty时,我没有遇到这样的错误,一切都正常工作。

也许您有任何关于如何解决这个问题的想法?

您可以在此截图中找到我的配置:
Resin上的错误Java版本

英文:

In our project, we are using Resin as the production server. On my local machine, I was using Jetty but I've faced some differences in the application's behavior on different servers. That's why I am trying to add configuration to Intellij IDEA which will use Resin as an application server.
When I am trying to run it, I get the following error:

[20-09-03 16:35:39.134] {resin-port-80-49} warning: [options] bootstrap class path not set in conjunction with -source 1.5
                       warning: [options] source value 1.5 is obsolete and will be removed in a future release
                       warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
                       /include/header.jsp:70: error: diamond operator is not supported in -source 1.5
                                 List<String> jsEncodedItems = new ArrayList<>(list.size());
                                                                             ^
                         (use -source 7 or higher to enable diamond operator)
                       1 error
                       3 warnings

I've checked the Java version in "Project structure" and in maven's pom.xml but everywhere I've found 1.8. Meanwhile, using Jetty I don't get an error like this, and everything works as expected.
Maybe you have any idea how to fix this?
You can find my configuration on this screenshot:
Resin上的错误Java版本

答案1

得分: 1

这是因为 Resin 使用 javac 来自动编译您的 JSP 文件,如果没有 "-source " 参数,它将默认使用 1.5 作为源版本。

要在 Resin 中修复这个问题,编辑 resin.xml,在 <resin> 标签内部添加以下之一:

<javac compiler="internal" args="-source 1.8"/>

或者

<javac compiler="javac" args="-source 1.8"/>

根据您的需求更改源版本。

英文:

This is beacause resin uses javac to auto compile your JSP files, and without "-source " argument, it will use 1.5 as source version as default.

To fix this in resin, edit resin.xml, add one of the below inside &lt;resin&gt;:

&lt;javac compiler=&quot;internal&quot; args=&quot;-source 1.8&quot;/&gt;

or

&lt;javac compiler=&quot;javac&quot; args=&quot;-source 1.8&quot;/&gt;

change the source version whatever you like.

huangapple
  • 本文由 发表于 2020年9月3日 21:54:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/63725120.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定