简体   繁体   English

如何在将升级到 Java 11 的 Java 8 项目中运行新功能?

[英]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.

相关问题 upgraded maven pom.xml from java 8 to 13. how can i run upgraded maven project on both java 8 and 13 installed machines - upgraded maven pom.xml from java 8 to 13. how can i run upgraded maven project on both java 8 and 13 installed machines 如何在Eclipse for OSX中打开并运行此Java项目 - How do I open and run this Java project in Eclipse for OSX 如何从命令行运行intellij Java项目? - How do i run an intellij Java project from command line? 如何在browserstack黄瓜java功能并行运行? - How can I run in browserstack cucumber java features in parallel? 如何在 Java 11 中使用 BouncyCastleProvider - How do I use BouncyCastleProvider in Java 11 如何在没有 web.xml 的情况下将 App Engine 项目更新到 Java 11? - How do I update an App Engine project to Java 11 without web.xml? 如何实现 java 井字游戏功能 - How do I implement java tic tac toe game features 如何在Eclipse中运行具有main()的单个Java文件,而无需创建整个Java项目? - How do I run a single Java file having main() in Eclipse, without creating an entire Java project? Java 7 中的新特性 - New features in java 7 当我将 Java 版本升级到 openJDK 11 时,加载模型映射器配置时出现 nullpointerException - When i upgraded java version to openJDK 11, I am getting nullpointerException while loading modelmapper configurations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM