通过Commandline在Jboss 7.0.1中部署war [英] Deploying war in Jboss 7.0.1 through Commandline

查看:186
本文介绍了通过Commandline在Jboss 7.0.1中部署war的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个war文件,我需要在Jboss 7.0.1 Server上部署它。现在我已经阅读了文档,但没有找到任何部署war文件的东西。此外,要通过命令行部署构建,通常必须使用maven。那么我们也需要战争吗?如果是这样,它会影响war文件吗?

I have a war file and I need to deploy it on Jboss 7.0.1 Server. Now I have gone through the documentation, but didnt find any thing to deploy a war file. Moreover for deploying your build through command line you generally have to use maven. So do we need for the war as well? If so, does it affects the war file?

FYI:我使用的是linux(CentOs5)......

FYI : I am using linux (CentOs5)...

推荐答案

您可以使用管理命令行界面部署 .war 文件。它的具体文档位于: JBoss AS7管理员指南 - 部署,以及下面的相关部分。您可能还希望快速观看视频:将您的应用程序部署到JBoss AS7的5种方法

You can deploy a .war file using the Management Command Line Interface. The specific documentation for it is located here: JBoss AS7 Admin Guide - Deployment, with the relevant sections per the below. You might also like to have a quick watch of the video: 5 Ways To Deploy Your Applications To JBoss AS7

CLI部署到托管域

分发部署二进制文件涉及两个步骤:您需要将部署上载到存储库,域控制器可以从该存储库分发其内容。在第二步中,您需要将部署分配给一个或多个服务器组:

The process of distributing deployment binaries involves two steps: You need to upload the deployment to the repository from which the domain controller can distribute it's contents. In a second step you need to assign the deployment to one or more server groups:

使用CLI,您可以执行一次扫描:

Using the CLI you can do it one sweep:

[domain@localhost:9999 /] deploy ~/Desktop/test-application.war
Either --all-server-groups or --server-groups must be specified.

[domain@localhost:9999 /] deploy ~/Desktop/test-application.war --all-server-groups
'test-application.war' deployed successfully.

[domain@localhost:9999 /] deploy --help
[...]

使用deploy命令上传二进制文件后,域控制器可以使用它
并分配给服务器组:

After you've uploaded the binary using the "deploy" command, it will be available to the domain controller and assigned to a server group:

[domain@localhost:9999 /] :read-children-names(child-type=deployment)
{
   "outcome" => "success",
   "result" => [
       "mysql-connector-java-5.1.15.jar",
       "test-application.war"
   ]
}

[domain@localhost:9999 /] /server-group=main-server-group/deployment=test-application.war:read-resource
{
   "outcome" => "success",
   "result" => {
       "enabled" => true,
       "name" => "test-application.war",
       "runtime-name" => "test-application.war"
   }
}

以类似方式它可以从服务器组中删除:

In a similar way it can be removed from the server group:

[domain@localhost:9999 /] undeploy test-application.war --all-relevant-server-groups
Successfully undeployed test-application.war.

[domain@localhost:9999 /] /server-group=main-server-group:read-children-names(child-type=deployment)
{
   "outcome" => "success",
   "result" => []
}

CLI部署到独立服务器

独立服务器上的部署与托管域类似,只是服务器组关联不存在。您可以依赖与托管域相同的CLI命令来部署应用程序:

Deployment on a standalone server works similar to the managed domain, just that the server-group associations don't exist. You can rely on the same CLI command as for a managed domain to deploy an application:

[standalone@localhost:9999 /] deploy ~/Desktop/test-application.war
'test-application.war' deployed successfully.

[standalone@localhost:9999 /] undeploy test-application.war
Successfully undeployed test-application.war.

CLI部署到独立服务器(一个线程Shell命令)

您也可以从Shell一次性部署WAR。这对Bash脚本或Unix别名很有用。注意:这会公开密码,因此仅将其用于个人开发实例。确保设置了$ JBOSS_HOME,并更改密码和WAR文件路径&根据需要在下面命名:

You can deploy a WAR in one shot from the Shell as well. This is useful for Bash scripts or Unix aliases. NOTE: This exposes the password, so only use it for personal development instances. Ensure $JBOSS_HOME is set, and change Password and WAR file path & name below as needed:

$ $JBOSS_HOME/bin/jboss-cli.sh -u=admin -p=MY_PASSWORD --controller=localhost:9990 --connect --command="deploy /path/to/MY_APP.war --force"

脚注:如您所知,您已经拥有用于部署的管理控制台以及部署扫描程序。前者像任何GUI一样受欢迎,但后者更适合开发。我尝试尽可能多地使用CLI,因为学习曲线非常值得批量编写脚本以及CLI API公开的低级别操作的绝对规模。很酷的东西。我应该为了透明起见而添加我在AS / EAP文档团队工作,所以我可能会有偏见。

Footnote: As you would know, you've got the Management Console for deployment, as well as the deployment scanner. The former is popular as any GUI would be, but the latter is more for development. I try to use the CLI as much as possible, as the learning curve is well worth the effort for the power of batch scripting and the sheer scale of low level operations that are exposed by the CLI API. Very cool stuff. I should add for sake of transparency that I work on the AS/EAP documentation team, so I might be biased.

这篇关于通过Commandline在Jboss 7.0.1中部署war的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆