JBOSS如何识别EAR文件

时间:2016-09-19 09:52:13

标签: java jboss

您好我有EAR文件并放在Jboss服务器的Jboss Standalone /部署路径中,它工作正常但是JBOSS如何识别EAR文件存在疑问,请您简单解释一下JBOSS的内部流程

2 个答案:

答案 0 :(得分:2)

这是JBoss文件部署扫描程序: https://docs.jboss.org/author/display/AS7/Deployment+Scanner+configuration

您可以通过standalone.xml配置它。

它基本上会检测到新的部署文件(EAR,WAR,JAR)(检查修改日期是否更新,如果之前存在该文件)。

您还可以使用earname.dodeploy,* .doundeploy等特殊文件来控制它,并生成指示其功能的文件:* .isdeploying,* .deployed。

答案 1 :(得分:1)

部署扫描程序仅用于独立模式。它的工作是监视目录中的新文件并部署这些文件。它可以在 standalone.xml

中找到
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner scan-interval="5000"
   relative-to="jboss.server.base.dir" path="deployments" />
</subsystem>

您可以定义更多部署扫描程序条目,以便从更多位置扫描部署。显示的配置将每隔五秒扫描 $ JBOSS_HOME / standalone / deployments 目录。运行时模型如下所示,并使用xml中未指定的属性的默认值:

[standalone@localhost:9999 /] /subsystem=deployment-scanner:read-resource(recursive=true)
{
"outcome" => "success",
"result" => {"scanner" => {"default" => {
    "auto-deploy-exploded" => false,
    "auto-deploy-zipped" => true,
    "deployment-timeout" => 60L,
    "name" => "default",
    "path" => "deployments",
    "relative-to" => "jboss.server.base.dir",
    "scan-enabled" => true,
    "scan-interval" => 5000
}}}
}

可以通过在启动服务器之前修改standalone.xml来添加部署扫描程序,也可以使用CLI(命令行界面)在运行时添加和删除它们。

[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=new:add(scan-interval=10000,relative-to="jboss.server.base.dir",path="other-deployments")
{"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=new:remove                                              
{"outcome" => "success"}

您还可以在运行时更改属性,例如关闭扫描即可

[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=default:write-attribute(name="scan-enabled",value=false)
{"outcome" => "success"}
[standalone@localhost:9999 /] /subsystem=deployment-scanner:read-resource(recursive=true)                                    {
"outcome" => "success",
"result" => {"scanner" => {"default" => {
    "auto-deploy-exploded" => false,
    "auto-deploy-zipped" => true,
    "deployment-timeout" => 60L,
    "name" => "default",
    "path" => "deployments",
    "relative-to" => "jboss.server.base.dir",
    "scan-enabled" => false,
    "scan-interval" => 5000
}}}
}

JBoss Application Server 7发行版中的独立/部署目录是最终用户可以放置其部署内容(例如war,ear,jar,sar文件)以将其自动部署到服务器运行时的位置。