[英]How do I run new features in a Java 8 project that will be upgraded to Java 11?
I'm supposed to upgrade a Java project from 8 to 11. I've been told to add some features initially to test if the server runs but it doesn't.我应该将一个 Java 项目从 8 升级到 11。有人告诉我最初要添加一些功能来测试服务器是否运行但它没有。 This is what I did.
这就是我所做的。 In pom.xml, I changed
在 pom.xml 中,我改变了
<jdk.version>1.8</jdk.version>
to到
<jdk.version>11</jdk.version>
And in the feature set xml file (RestProject/src/main/liberty/config/include/feature-set-ee8.xml) of Liberty Server, I changed the following:在 Liberty Server 的功能集 xml 文件 (RestProject/src/main/liberty/config/include/feature-set-ee8.xml) 中,我更改了以下内容:
<server>
<featureManager>
<feature>webProfile-8.0</feature>
<feature>jms-2.0</feature>
<feature>jaxb-2.2</feature>
<feature>localConnector-1.0</feature>
</featureManager>
</server>
to到
<server>
<featureManager>
<feature>webProfile-9.1</feature>
<feature>xmlBinding-3.0</feature>
<feature>messaging-3.0</feature>
</featureManager>
</server>
But when I run the server, I get the following error:但是当我运行服务器时,出现以下错误:
[ERROR ] CWWKF0044E: The webProfile-9.1 and com.ibm.websphere.appserver.builtinAuthentication-1.0 features cannot be loaded at the same time. The webProfile-9.1 feature of Jakarta EE 9 is incompatible with the com.ibm.websphere.appserver.builtinAuthentication-1.0 feature of Java EE 6. The webProfile-9.1 and webProfile-9.1 configured features include an incompatible combination of features. Your configuration is not supported. Update the configuration to use features that support either the Jakarta EE or Java EE programming models, but not both.
[ERROR ] CWWKF0033E: The singleton features servlet-5.0 and servlet-4.0 cannot be loaded at the same time. The configured features webProfile-9.1 and jaxrs-2.1 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.
I tried copying over some stuff from the default server's server.xml to this project's server.xml but it keeps resetting whenever I run the server.我尝试将一些东西从默认服务器的 server.xml 复制到这个项目的 server.xml 但每当我运行服务器时它都会不断重置。 Am I supposed to use a specific version of these features?
我应该使用这些功能的特定版本吗?
These features aren't tied to the Java version, they're tied to the server version.这些功能与 Java 版本无关,它们与服务器版本相关。 While you can still upgrade Java from 8 to 11, you can't upgrade Java/Jakarta EE to version 9 yet.
虽然您仍然可以将 Java 从 8 升级到 11,但您还不能将 Java/Jakarta EE 升级到版本 9。 The problem with that is that the package names have changed - in Java EE and in Jakarta EE 8, packages started with
javax
.问题在于 package 名称已更改 - 在 Java EE 和 Jakarta EE 8 中,包以
javax
开头。 In Jakarta 9 and later, packages start with jakarta
.在 Jakarta 9 及更高版本中,包以
jakarta
开头。 That makes them 100% incompatible.这使它们 100% 不兼容。
So until you have to update the server as well, just keep the old feature versions.因此,在您也必须更新服务器之前,只需保留旧的功能版本即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.