use*_*911 7 eclipse deployment jboss maven wildfly
在 Eclipse 中访问http://localhost:8080/bword时出现“404 Not found”错误消息 。
此应用程序在 Wildfly 中提供。在 POM.xml 中,它定义了:
<artifactId>bword</artifactId>
<packaging>war</packaging>
<name>bword</name>
Run Code Online (Sandbox Code Playgroud)
然而,奇怪的是,当我在 Eclipse 中运行应用程序并将 Wildfly 9.0 配置为服务器时,部署到 wildfly/standone/deployments/ 的是 bbword.war,如下所示:
[abigail@localhost wildfly-9.0.2.Final]$ ls standalone/deployments/
bbword.war/ bbword.war.deployed
Run Code Online (Sandbox Code Playgroud)
这是错误的,应该是“bword.war/”和“bword.war.deployed”。
在Eclipse之外,如果我在项目“bword”下“mvn clean package”,我可以得到target/目录下的“bword.war”。
请参阅附件截图以供参考。我怀疑在我的 pom、eclipse 或任何地方的某个地方,“bbword”而不是“bword”的配置错误,但我真的找不到它。我找不到任何“bbword”的踪迹。部署下部署的war文件的名称是什么?
见附件。
编辑(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>
Run Code Online (Sandbox Code Playgroud)
补充一点:
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
Run Code Online (Sandbox Code Playgroud)
......
这是我在 Wildfly 上单击“作为服务器运行”后控制台消息的最初部分。似乎显示“在部署目录中找到 bbword.war”。在运行它之前,我删除了 standalone/deployments/* 中的所有内容。它从一个空目录开始。每当我运行服务器时,似乎“bbword.war”都会被复制到这个目录中。我想不通。我在我的电脑上使用“find / -name bbword.war”但是找不到这个文件。真的很纳闷。
更新:
最终发现问题:在项目'bword'下,有一个“.setting”目录,里面包含这个文件:bword/.settings/org.eclipse.wst.common.component
其中有一行: ,其中“bbword”是我之前使用的部署名称。删除此目录并在 Maven 中运行“更新”似乎可以解决此问题。特别是我需要两者都做,先删除这个目录,.setting,然后更新maven。
浪费了几天时间,但很高兴知道这一点。
首先,尝试在您的服务器上部署 maven 构建的工件 (bword.war)(不要忘记首先完全清理任何 Eclipse 部署的工件)。
您只需将文件夹bword.war
从您的文件夹移动/target
到您的path_to_wildfly/standalone/deployments
文件夹即可完成此操作。
检查服务器日志文件中的消息:Registered web context: <web_context_name>
部署战争后应该会出现该消息。如果它显示/bbword - 这不是您所期望的,请检查您是否有一个jboss-web.xml
文件src/main/webapp/WEB-INF
将其指定为web-context
值。
如果 Maven 工件生成正确的 webcontext - /bword,那么它一定是 Eclipse 配置问题。您是否尝试过从 Maven 更新 Eclipse 项目?:
祝你好运。
归档时间: |
|
查看次数: |
7610 次 |
最近记录: |