The helloworld-mbean
quickstart demonstrates the use of CDI and MBean in {productName} and includes JConsole instructions and Arquillian tests.
The helloworld-mbean
quickstart demonstrates the use of CDI and MBean in {productNameFull}. The project also includes a set of Arquillian tests for MBeans.
The example is composed of the following MBeans.
MBean | Description |
---|---|
|
This MBean is a managed bean with |
|
This MBean is a managed bean with |
|
This MBean is a POJO using |
|
This MBean is a pojo using |
../shared-doc/system-requirements.adoc ../shared-doc/use-of-jboss-home-name.adoc ../shared-doc/start-the-standalone-server.adoc ../shared-doc/build-and-deploy-the-quickstart.adoc
This also deploys the {artifactId}-service/target/{artifactId}-service.sar
to the running instance of the server.
This quickstart differs from the other quickstarts in that it uses JConsole to access and test the quickstart rather than access an URL in the browser. If you do access http://localhost:8080/{artifactId}-webapp/, you will see a screen shot image of the JConsole application,
The following sections describe how to use JConsole to inspect and test the MBeans.
-
To connect to the {productName} server using JConsole, open a terminal and type the following command, replacing JDK_HOME with the path to your JDK installation :
JDK_HOME/bin/jconsole
NoteFor Windows, type JDK_HOME\bin\jconsole.exe
. -
Select the local org.jboss.modules.Main process and click Connect.
-
A dialog displays with the warning:
Secure connection failed. Retry insecurely?
-
Click Insecure to continue.
-
Click on the MBeans tab.
-
Expand quickstarts in the left column of the console.
-
Under quickstarts, you see the 4 MBeans: AnnotatedComponentHelloWorld, MXComponentHelloWorld, MXPojoHelloWorld, and SarMXPojoHelloWorld
-
Expand each MBean and choose: Operations → sayHello.
-
Type your name in the (p0 String ) input text box and click the sayHello button.
-
For the AnnotatedComponentHelloWorld and MXComponentHelloWorld examples, you will see a popup Window displaying Hello <your name>!.
-
For the MXPojoHelloWorld and SarMXPojoHelloWorld examples, you will see a popup Window displaying Welcome <your name>!.
-
../shared-doc/undeploy-the-quickstart.adoc ../shared-doc/run-arquillian-tests.adoc ../shared-doc/run-the-quickstart-in-jboss-developer-studio.adoc
This quickstart consists of multiple projects and requires installation of the JBoss Tools Maven Packaging Configurator
, so it deploys and runs differently in {JBDSProductName} than the other quickstarts.
-
Install the JBoss Tools Maven Packaging Configurator
-
If the Red Hat Central page is not showing, open it by choosing Help → Red Hat Central.
-
Click the Software/Update tab at the bottom of the Red Hat Central.
-
Scroll down to the Maven section, select the JBoss Tools Maven Packaging Configurator and click Install/Update.
-
-
Right click on the parent {artifactId} parent project and choose Maven → Update Project…. Select all projects and click OK.
-
Right-click on the {artifactId}-service project and choose Run As → Run on Server.
-
Right-click on the {artifactId}-webapp project and choose Run As → Run on Server.
-
Start JConsole and Test the MBeans in JConsole as described above.
-
To undeploy the web application, right-click on the {artifactId}-wepapp project and choose Run As → Maven build. Enter
wildfly:undeploy
for the Goals and click Run. -
To undeploy the web service, right-click on the {artifactId}-service project and choose Run As → Maven build. Enter
wildfly:undeploy
for the Goals and click Run.