gpt4 book ai didi

Eclipse 上的 Java Wildfly swarm

转载 作者:行者123 更新时间:2023-11-30 06:30:50 26 4
gpt4 key购买 nike

Java 和 Wildfly Swarm 专家您好,

我有一个问题。我使用 Wildfly Swarm 和 EJB 在 Eclipse 中构建了一个微服务项目。该项目名为 TestProject,并将构建一个 TestProject.war。

当我在终端中运行时,使用命令“mvn wildfly-swarm:run”,它运行正常,并且会在某种程度上构建正确的 war 文件。下面是运行时的片段:

2017-09-12 12:03:34,884 INFO  [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.4.0.Final
2017-09-12 12:03:34,971 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
2017-09-12 12:03:35,056 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on [0:0:0:0:0:0:0:0]:8080
2017-09-12 12:03:35,176 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) started in 1140ms - Started 132 of 143 services (25 services are lazy, passive or on-demand)
2017-09-12 12:03:36,380 INFO [org.wildfly.swarm.runtime.deployer] (main) deploying TestProject.war
2017-09-12 12:03:36,398 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "TestProject.war" (runtime-name: "TestProject.war")
2017-09-12 12:03:37,779 WARN [org.jboss.as.dependency.private] (MSC service thread 1-2) WFLYSRV0018: Deployment "deployment.TestProject.war" is using a private module ("org.jboss.jts:main") which may be changed or removed in future versions without notice.
2017-09-12 12:03:38,114 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-1) WFLYEJB0473: JNDI bindings for session bean named 'ProductRestBean' in deployment unit 'deployment "TestProject.war"' are as follows:

java:global/TestProject/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:app/TestProject/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:module/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:global/TestProject/ProductRestBean
java:app/TestProject/ProductRestBean
java:module/ProductRestBean

当我在 Eclipse IDE 中运行时,它仍然会运行,但它创建的 war 不同,导致 bean 加载并稍后查找,无法加载。下面是关于它如何在 Eclipse 中运行(有问题)的片段:

[0m[0m2017-09-12 12:36:46,741 INFO  [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.4.0.Final
[0m[0m2017-09-12 12:36:46,795 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
[0m[0m2017-09-12 12:36:46,871 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on [0:0:0:0:0:0:0:0]:8080
[0m[0m2017-09-12 12:36:46,997 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Swarm 2017.3.3 (WildFly Core 2.2.1.CR1) started in 1197ms - Started 132 of 143 services (25 services are lazy, passive or on-demand)
[0m[0m2017-09-12 12:36:48,232 INFO [org.wildfly.swarm.runtime.deployer] (main) deploying 507ac020-cc98-4956-9c88-418869842dcf.war
[0m[0m2017-09-12 12:36:48,252 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "507ac020-cc98-4956-9c88-418869842dcf.war" (runtime-name: "507ac020-cc98-4956-9c88-418869842dcf.war")
[0m[33m2017-09-12 12:36:49,676 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) WFLYSRV0018: Deployment "deployment.507ac020-cc98-4956-9c88-418869842dcf.war" is using a private module ("org.jboss.jts:main") which may be changed or removed in future versions without notice.
[0m[0m2017-09-12 12:36:49,966 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-3) WFLYEJB0473: JNDI bindings for session bean named 'ProductRestBean' in deployment unit 'deployment "507ac020-cc98-4956-9c88-418869842dcf.war"' are as follows:

java:global/507ac020-cc98-4956-9c88-418869842dcf/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:app/507ac020-cc98-4956-9c88-418869842dcf/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:module/ProductRestBean!com.mycompany.ejb.ProductRestBeanInterface
java:global/507ac020-cc98-4956-9c88-418869842dcf/ProductRestBean
java:app/507ac020-cc98-4956-9c88-418869842dcf/ProductRestBean
java:module/ProductRestBean

正如我们所观察到的,它创建了 war 文件:

507ac020-cc98-4956-9c88-418869842dcf.war

而不是:

TestProject.war

我很高兴能够了解如何防止 Eclipse 创建随机命名的 war 文件并使用预期的 war 文件名(即 TestProject.war)。

非常感谢!祝你有美好的一天 =)!

最佳答案

解决方案是将这些行添加到项目的projects-default.yml 中。

swarm:
app:
name: TestProject.war

关于Eclipse 上的 Java Wildfly swarm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46166834/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com