`

SAR (Service Archive) file in JBoss

阅读更多

SAR (Service Archive)

This tips explains how to create and deploy the SAR file in the JBoss application server. SAR files are only used in the JBoss application server. It cannot be used in the other application server environments. Before looking into creating a SAR file, first let you know what is SAR file.

What is SAR file?

SAR file is created with the .sar extenstion same like how other archive files (JAR, WAR, EAR) created. But the purpose of the SAR file is differenet from the other archive files. It is used for deploying a service component in the application server without dependent on other componenets. You can create a seperate componenet as a SAR file and deploy it in the server. When application server starts, the component will be deployed and started running independently. Most of the times these SAR files are used for writing thread related components which has to be running independently.

JBoss's service archive architecture is based on the Java Extension Management (JMX). During the server bootup process, the service archive deployer (SARDeployer) instantiates the JBoss service classes and exposes them as manageable beans through JMX. You can view all of registered JBoss service components in the JBoss JMX Console web application.

Create SAR file

In this section we will see how to create the SAR file. The following are the steps required to create a SAR file:

Add JAR Files

Jakarta Commons IO, Jakarta Commons Logging, jboss-common.jar, jboss-jmx.jar ,jboss-system.jar, jboss-xml-binding.jar

Create MBean interface as Follows :


	public interface JavaBeatMBean implements ServiceMBean{
		public void start();
		public void stop();
	}

Create MBean implementation class as Follows :


	public class JavaBeat{
		public void start(){
			System.out.println("Test Start");
		}
		public void stop(){
			System.out.println("Test Stop");
		}
	}

Create a new implementation class, JavaBeat, that implements JavaBeatMBean. As prescribed by the standard MBean specs, the implemented class must have the same name as the MBean interface minus the "MBean" suffix. Now we have created the service componenet, its time to package and deploy the componenet.

Create jboss-service.xml as follows:


	<server>
		<mbean code="JavaBeat"
		name="service.javabeat:service=JavaBeat"/>
	</server>

This file should be kept inside the META-INF folder.

Build and create SAR file

 


When you build and creating the SAR file, it should be in the following package structure:
javabeat-service.sar->META-INF/jboss-service.xml
javabeat-service.sar->JavaBeat.class
javabeat-service.sar->JavaBeatMBean.class
javabeat-service.sar->JAR files

 

when you deploy this SAR file, application server will deploy the componenet and start the JavaBeat class's start methods. start is a callback method in the MBean interfaces.

分享到:
评论

相关推荐

    jboss-service.xml could not be opened, does it exist 配置jboss遇到的问题

    如文章中提到的端口修改问题路径:`jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\server.xml` 中的 `${jboss.bind.address}"&gt;` 需要根据实际情况进行调整。 5. **文件权限**:检查文件的权限设置,确保...

    jboss 下载(httpwww.jboss.org)

    4. 配置 JBoss 的端口,例如将 HTTP 服务监听端口改为 80,需编辑 `jbossweb-tomcat41.sar\META-INF\jboss-service.xml` 文件。 JBoss 的目录结构包含: 1. bin:启动和停止 JBoss 的脚本。 2. docs:包含示例、...

    jboss配置入门,jboss的初级配置

    例如,在jboss3.2.3中,我们可以修改%JBOSS_HOME%/server/default/deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml文件,以实现session sticky配置。 jboss的应用程序下载和安装 jboss的应用程序可以从...

    jboss4版本修复Apache Tomcat DIGEST身份验证多个安全漏洞(CVE-2012-3439)升级包

    jboss4版本下,jbossweb-tomcat55.sar升级包,修复Apache Tomcat DIGEST身份验证多个安全漏洞(CVE-2012-3439) 升级包中的jar来源于tomcat5.5.36 使用方法:直接替换jboss中旧的jbossweb-tomcat55.sar

    SAR 解压工具

    SAPCAR -avf archive.sar file1 file2 file3 提取/验证文件: 如果尝试从一个不满足 SAPCAR 第二版规范的文档中提取文件,SAPCAR 假设它是 旧格式的档案,并自动启动相应的提取例程。如果仍旧无法处理这个档案,它...

    jboss入门

    ### jBoss入门详解 ...以JBOSS3.2.3为例,需要修改`%JBOSS_HOME%/server/default/deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml`中的`&lt;Engine name="MainEngine" defaultHost="localhost"&gt;`为`...

    JBOSS4.2.3 文件结构图

    - **persistent-service.sar**:这是一个部署在JBoss上的服务归档文件,用于提供持久化服务。 - `META-INF`:元数据信息目录。 - `jboss-service.xml`:服务配置文件。 - `MANIFEST.MF`:归档文件的清单信息。 -...

    JBOSS log4j 配置

    1. 配置 $JBOSS-HOME/server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml 文件里的 Java2ClassLoadingCompliance 及 UseJBossWebLoader 为 false,如果应用程序下存在 WEB-INF/jboss-web.xml...

    阿里hsf接口 sar包

    在阿里巴巴的HSF框架中,`.sar`文件是一种特殊格式的压缩包,全称为Service Archive,它是HSF服务的容器,包含了服务提供者所需要的所有依赖和配置信息。`.sar`文件的作用类似于Java的`.war`或`.ear`文件,用于打包...

    一台机器部署多个jboss说明

    &lt;mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"&gt; &lt;attribute name="Port"&gt;1098 &lt;attribute name="Port"&gt;1099 ``` - **...

    JBOSS负载均衡配置

    - `%JBoss_Home%\server\all\deploy`和`%JBoss_Home%\server\default\deploy`目录下的`deploy.last`、`jboss-web-cluster.sar`、`cluster-service.xml`和`ejb3-clustered-sfsbcache-service.xml`。 5. **配置集群...

    JBoss5部署原理

    - **VFSBootstrapScannerImpl**:实现类,负责监控`conf/jboss-service.xml`文件,创建`DeploymentContext`对象,并将其添加到当前的Profile中。 - **VFSDeploymentScanner**:用于监控部署目录的变化,根据文件类型...

    欺骗干扰SAR成像_SAR欺骗_SAR干扰_sar成像_SAR干扰_matlab欺骗干扰

    在现代电子战中,合成孔径雷达(Synthetic Aperture Radar, SAR)作为一种重要的远程成像技术,被广泛应用于军事和民用领域。然而,SAR系统并非无懈可击,其成像过程容易受到各种干扰,其中“欺骗干扰”是一种极具...

    linux 下 配置JBoss6.0+JDK7.0

    - 直接编辑`/usr/local/JBoss/server/default/deploy/jbossweb.sar/server.xml`文件,但这样做可能影响到备份和更新。 - 更推荐的方法是编辑`bindings-jboss-beans.xml`文件,比如在`/usr/local/JBoss/server/...

    SAR_DATA1.rar_SAR MATLAB_SAR 处理_SAR_原始数据_SAR数据_raw data

    在标题"SAR_DATA1.rar_SAR MATLAB_SAR 处理_SAR_原始数据_SAR数据_raw data"中,提到了SAR数据处理和MATLAB的使用。MATLAB是一种强大的数值计算和可视化工具,广泛用于SAR数据的分析和处理。它提供了丰富的库函数和...

    windows下JBOSS5.1.0部署web应用

    为确保正确的字符编码,可以在`$JBOSS_HOME/server/default/conf/jboss-system.properties`文件中设置`jboss.system:Service=PropertiesService`的`defaultPropertyCharset`属性。 7. **修改日志配置**: 日志...

    SAR_ADC_SARADC-matlab_sar数据_SARADC_saradcmatlab_SARADC建模

    标题中的"SAR_ADC_SARADC-matlab_sar数据_SARADC_saradcmatlab_SARADC建模"暗示了我们讨论的主题是基于MATLAB的SAR(Successive Approximation Register,逐次逼近寄存器)ADC(Analog-to-Digital Converter,模拟到...

    jboss安全性 jboss设置安全性

    同样地,需要修改`%JBOSS_HOME%/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml`文件。在这个文件中添加依赖项以确保与插件管理器服务的正确交互: ```xml &lt;jboss-web&gt; ...

Global site tag (gtag.js) - Google Analytics