2008-05-18
JBOSS 下的自定义service实现 (JMX)
关键字: jmx jboss service
参考文章 http://blog.platinumsolutions.com/node/85
最近在研究 smallworld的sias 所以研究到了 jboss 的jmx,在这里写了一个demo
首先写一个接口要继承servicebean 这里注意要接口的名字 要和你写的实现类名字符合
在基础上加上MBean 否则部署的时候会报错 Class does not expose a management interface exception java.lang.Object
Warning: If the service class (ServiceMBeanSupport) is called <servicename>, the interface must be called <servicename>MBean. Otherwise, you will receive a Class does not expose a management interface exception.
然后写一个实现类 注意 实现类应该和接口在同一包下
这里面,接口我没有写方法,所以实现类没有任何实现。
这个是service的配置文件 jboss-service.xml 可以但到,code对应的是具体的实现类
name的格式:描述:service=servicename
要把这个文件打包到 META-INF下 采用ant打包,哦忘记说了这里要引用到jboss的包
jboss.home\lib\jboss-jmx.jar jboss.home\lib\jboss-system.jar jboss.home\server\jboss.config\lib\scheduler-plugin.jar
这里ant怎么打包我就不说了我把我写的最后打包的文件一起传上来放在附件里面了。以供单靠
最近在研究 smallworld的sias 所以研究到了 jboss 的jmx,在这里写了一个demo
首先写一个接口要继承servicebean 这里注意要接口的名字 要和你写的实现类名字符合
在基础上加上MBean 否则部署的时候会报错 Class does not expose a management interface exception java.lang.Object
引用
Warning: If the service class (ServiceMBeanSupport) is called <servicename>, the interface must be called <servicename>MBean. Otherwise, you will receive a Class does not expose a management interface exception.
public interface BlogExampleServiceMBean extends ServiceMBean {
}
然后写一个实现类 注意 实现类应该和接口在同一包下
public class BlogExampleService extends ServiceMBeanSupport implements BlogExampleServiceMBean {
}
这里面,接口我没有写方法,所以实现类没有任何实现。
这个是service的配置文件 jboss-service.xml 可以但到,code对应的是具体的实现类
name的格式:描述:service=servicename
<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="com.test.service.BlogExampleService" name="com.test:service=testce"> </mbean> </server>
要把这个文件打包到 META-INF下 采用ant打包,哦忘记说了这里要引用到jboss的包
jboss.home\lib\jboss-jmx.jar jboss.home\lib\jboss-system.jar jboss.home\server\jboss.config\lib\scheduler-plugin.jar
这里ant怎么打包我就不说了我把我写的最后打包的文件一起传上来放在附件里面了。以供单靠
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 12138 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
我的相册
/home/hgh/
共 1 张
共 1 张
最近加入圈子
最新评论
-
java RMI的例子
客户端可以调用服务器端的类,不过我想实现客户端和服务器端交互怎么实现呢?最近也在 ...
-- by foolfisher -
java RMI的例子
那添到到web里面是怎么个添加步骤。简单的说是怎么运用吧。能说明一下吗?
-- by pan19849529 -
java RMI的例子
那添加到web里面怎么添加是什么步骤呢。能说明一下吗?
-- by pan19849529 -
javascript 实现分页
ajax分页,可以参考下我的文章:http://www.javaeye.com/ ...
-- by 笨笨狗 -
javascript 实现分页
怎么显示不出来职?
-- by liuzongan






评论排行榜