我已经尝试了好几天来使用 jboss-as-maven-plugin
将 Web 项目部署到远程 JBoss AS7,但没有成功。
这是我的 pom.xml
:
<!-- JBoss Application Server -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.CR1b</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<!-- Only remote server needs -->
<configuration>
<hostname>192.168.1.104</hostname>
<port>9999</port>
<username>admin</username>
<password>admin123</password>
</configuration>
</execution>
</executions>
</plugin>
使用此配置我可以部署到 localhost 而无需 <configuration>
, 甚至没有<username>
和 <password>
.
为了部署到我的真实 IP 地址,我修改了 ${JBOSS_HOME}/configuration/standlone.xml,通过更改 jboss.bind.address
从 127.0.0.1 到 0.0.0.0(解除绑定(bind) JBoss 地址),因此我可以使用以下方式部署项目:
<configuration>
<!-- 192.168.1.106 is my ip -->
<hostname>192.168.1.06</hostname>
<port>9999</port>
</configuration>
它也可以,但是通过改变 <hostname>
指向我的另一台计算机(在同一路由器中)它不起作用,但该计算机收到请求,并且该请求被某些东西切断了。 (我还以为可能是JBoss)
Maven控制台报错信息如下:
INFO: JBoss Remoting version 3.2.0.CR8
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.572s
[INFO] Finished at: Fri Feb 10 23:41:25 CST 2012
[INFO] Final Memory: 18M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.1.0.
CR1b:deploy (default) on project MessagePushX-RELEASE: Could not execute goal de
ploy on MessagePush.war. Reason: java.net.ConnectException: JBAS012144: Could no
t connect to remote://192.168.1.104:9999. The connection timed out -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
谁能告诉我JBoss as 7.1.0是不允许远程部署的?
为了一些安全问题?
最佳答案
这绝对不是安全问题。
您提到的插件使用 JBoss AS7 功能来使用服务器部署管理器部署应用程序(这是 AS7 中的新功能)。 Previously部署只能通过 JMX 控制台进行,这需要服务器(本地文件或 URL)可以访问部署 Artifact 。
您需要确保:
- 192.168.1.104 正在运行 JBoss AS7,服务器部署管理器监听端口 9999。
- 端口不应绑定(bind)到 localhost iface(不是 127.0.0.0:9999 而是 *:9999)。
- 在您和 192.168.1.104 之间没有防火墙拒绝到端口 9999 的数据包。
关于java - jboss-as-maven-plugin 无法部署到远程 JBoss AS7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9231916/