There is a simple example for you (in windows OS)
By the way ,you must add the jboss-system-x.x.x.jar and jboss-jmx-x.x.x.jar in your lib
path(or eclipse build path),these jar in JBoss lib dir.
|
| ##############################################
| package JMX;
|
| import org.jboss.system.ServiceMBean;
|
| public interface HelloWorldServiceMBean extends ServiceMBean {
|
| public String getMessage();
| public void setMessage(String message);
|
| }
| /***********************************************************/
| package JMX;
|
|
|
| import org.jboss.system.ServiceMBeanSupport;
| public class HelloWorldService extends ServiceMBeanSupport implements
HelloWorldServiceMBean {
| private String message;
|
| public HelloWorldService()
| {
| super();
| // TODO Auto-generated constructor stub
| }
|
| public String getMessage() {
| System.out.println("getMessage()=" + message);
| return message;
| }
|
|
|
| public void setMessage(String message) {
| System.out.println("setMessage(" + message + ")");
| this.message = message;
|
|
| }
|
|
| }/***********************************************************/
| jboss-service.xml
| -----------------------------------------------------------------------------------
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="JMX.HelloWorldService"
name="JBoss:service=HelloWorldService">
| <attribute name="Message">Hello World</attribute>
| </mbean>
| </server>----------------------------------------------------------
|
|
In your JBOSS deploy dir ,for example:"jboss-4.2.2.GA\server\default\deploy"
,you create a dir named "Hello.sar" and new create 2 files in
"Hello.sar" ,one named "JMX" and other named "META-INF".Then
put the HelloWorldService.class and HelloWorldServiceMBean.class in your "JMX"
dir. and new a XML file named jboss-service.xml write the content like above red XML.
ok you can run your JBOSS and access the
http://127.0.0.1:8080/jmx-console/
find the "service=HelloWorldService " in JBoss domain.
Note: I'm very sorry that my English not well.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170615#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...