【发布时间】:2016-03-18 04:37:11
【问题描述】:
我在访问时收到“404 Not found”错误消息: http://localhost:8080/bword 在 Eclipse 中。
此应用程序在 Wildfly 中提供。在 POM.xml 中,它定义了:
<artifactId>bword</artifactId>
<packaging>war</packaging>
<name>bword</name>
然而,奇怪的是,当我在 Eclipse 中运行应用程序并将 Wildfly 9.0 配置为服务器时,部署到 wildfly/standone/deployments/ 中的是 bbword.war,如下所示:
[abigail@localhost wildfly-9.0.2.Final]$ ls standalone/deployments/
bbword.war/ bbword.war.deployed
哪个不对,应该是“bword.war/”和“bword.war.deployed”。
在Eclipse之外,如果我在项目“bword”下“mvn clean package”,可以得到target/目录下的“bword.war”。
请参阅附件截图以供参考。我怀疑在我的 pom、eclipse 或任何地方的某个地方,“bbword”而不是“bword”的配置错误,但我真的找不到它。我找不到任何“bbword”的痕迹。什么决定了部署下部署的战争文件的名称?
见附件。
已编辑(POM.xml 的一部分):
<build>
<!-- Set the name of the war, used as the context root when the app
is deployed -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<!-- Java EE 7 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!-- WildFly plugin to deploy war -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
还有一个补充:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
17:32:35,508 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
17:32:35,702 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
17:32:35,761 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
17:32:36,573 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 22) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
17:32:36,594 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found bbword.war in deployment directory. To trigger deployment create a file called bbword.war.dodeploy
17:32:36,625 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
17:32:36,647 INFO [org.xnio] (MSC service thread 1-5) XNIO version 3.3.1.Final
......
这是我在 Wildfly 上单击“作为服务器运行”后控制台消息的初始部分。它似乎显示“在部署目录中找到 bbword.war”。在我运行它之前,我删除了standalone/deployments/*中的所有内容。它从一个空目录开始。每当我运行服务器时,似乎“bbword.war”都会复制到该目录中。我想不通。我在计算机上使用“find / -name bbword.war”,但找不到该文件。真的很困惑。
更新:
最终发现问题:在'bword'项目下,有一个“.setting”目录,里面有这个文件: bword/.settings/org.eclipse.wst.common.component
其中有一行: ,其中“bbword”是我之前使用的部署名称。删除此目录并在 Maven 中运行“更新”似乎可以解决此问题。特别是我需要两者都做,首先删除这个目录,.setting,然后更新maven。
为此浪费了几天时间,但很高兴知道这一点。
【问题讨论】:
-
你的 pom 中有更多的 Maven War 插件配置吗?
-
请查看编辑,这似乎不会导致问题。
标签: eclipse maven deployment jboss wildfly