美好的一天 Java 和 Wildfly Swarm 大师,
我有个问题。我使用 Wildfly Swarm 和 EJB 在 Eclipse 中构建了一个微服务项目。该项目名为 TestProject 并将构建一个 TestProject.war。
当我在终端中运行时,使用命令“mvn wildfly-swarm:run”它可以正常运行,并且会在一定程度上构建正确的战争文件。下面是它运行时的一个片段:
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 中运行时,它仍然会运行,但它创建的战争是不同的,导致 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
代替:
测试项目.war
我会很高兴了解如何防止 Eclipse 创建随机命名的 war 文件并使用预期的 war 文件名,即 TestProject.war。
非常感谢!祝你有美好的一天 =)!