我正在尝试将Wildfly服务器上运行的旧Java EE项目从Eclipse IDE迁移到Intellij Ultimate IDE。
我设法正确配置了启动应用程序所需的服务器和图片,但每次在Intellij Ultimate IDE中启动Wildfly服务器时,我都会收到以下错误:
D:\wildfly-22.0.0.Final\bin\standalone.bat
"C:\Program Files\Java\jdk-11.0.10\bin\java.exe" -Dfile.encoding=windows-1252 -classpath path\to\user\AppData\Local\Temp\classpath835606521.jar com.intellij.javaee.oss.process.JavaeeProcess 61015 com.intellij.javaee.oss.jboss.agent.WildFly11Agent
[2022-12-19 05:25:29,009] Artifact MyProject: Waiting for server connection to start artifact deployment...
Detected server admin port: 9990
Detected server http port: 8080
Calling "D:\wildfly-22.0.0.Final\bin\standalone.conf.bat"
"JAVA_OPTS already set in environment; overriding default settings with values: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:56525,suspend=y,server=n -javaagent:path\to\user\AppData\Local\JetBrains\IntelliJIdea2022.3\captureAgent\debugger-agent.jar "
Setting JAVA property to "C:\Program Files\Java\jdk-11.0.10\bin\java"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "D:\wildfly-22.0.0.Final"
JAVA: "C:\Program Files\Java\jdk-11.0.10\bin\java"
JAVA_OPTS: "-Dprogram.name=standalone.bat -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:56525,suspend=y,server=n -javaagent:path\to\user\AppData\Local\JetBrains\IntelliJIdea2022.3\captureAgent\debugger-agent.jar --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED"
===============================================================================
Connected to the target VM, address: '127.0.0.1:56525', transport: 'socket'
17:25:29,965 INFO [org.jboss.modules] (main) JBoss Modules version 1.11.0.Final
17:25:30,627 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.12.Final
17:25:30,638 INFO [org.jboss.threads] (main) JBoss Threads version 2.4.0.Final
17:25:30,786 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 22.0.0.Final (WildFly Core 14.0.0.Final) starting
17:25:31,733 INFO [org.wildfly.security] (ServerService Thread Pool -- 28) ELY00001: WildFly Elytron version 1.14.1.Final
17:25:32,425 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
17:25:32,462 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 33) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
17:25:34,113 INFO [org.jboss.as.repository] (ServerService Thread Pool -- 14) WFLYDR0001: Content added at location D:\wildfly-22.0.0.Final\standalone\data\content\45\dd237fa579ec67b846820741a8350364a118b0\content
17:25:34,130 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "MyProject.ear")]) - failure description: "WFLYCTL0212: Duplicate resource [(\"deployment\" => \"MyProject.ear\")]"
17:25:34,136 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
17:25:34,161 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0050: WildFly Full 22.0.0.Final (WildFly Core 14.0.0.Final) stopped in 6ms
查看服务器中的standalone.xml,问题似乎位于以下部分:
<deployments>
<deployment name="MyProject.ear" runtime-name="MyProject.ear">
<fs-archive path="D:\wildfly-22.0.0.Final\standalone\deployments\MyProject.ear"/>
</deployment>
</deployments>
删除这些行可使服务器正确启动和部署,但每次关闭服务器或重新启动IDE时都必须执行此操作
有什么办法可以防止这种情况发生吗?
此外,我的主EAR输出目录设置为D:\wildfly-22.0.0.Final\standalone\deployments
,我需要将该文件夹设置为该路径
1条答案
按热度按时间oewdyzsn1#
看起来服务器正在将EAR同时作为托管部署和非托管部署进行处理。下面的行表示EAR已经保存到服务器中,并且在引导时正在加载保存的副本:
此配置与
deployments
目录中的配置冲突。上面链接的文档解释了您可能希望使用托管部署(例如分发到服务器组)的原因,但如果您不需要托管部署,可以切换到非托管部署。再次删除config中的<deployments>
部分,然后在CLI中运行此配置: