Popular Posts

Sunday, August 31, 2008

How to use jconsole to monitor and manage WSO2 WSAS

Service or system monitoring and management are essential components of any SOA framework. WSO2 WSAS provides two different mechanisms to manage and monitor web services.
1. Ajax based GUI console
2. JMX based monitoring facility

In this post, I'm going to demonstrate the second option, JMX based service and system monitoring component. You can find more information about WSAS GUI console from here.

JMX (Java Management Extension) provides a set of tools and APIs for applying a standard client/server-based architecture to monitoring and management of a Java application.
J2SE version 5.0 adds core support for the Java Management Extensions (JMX) into the Java standard libraries. We are going to use Jconsole, included in jdk1.5 or newer versions, to explore the management and monitoring capabilities provided by WSO2 WSAS.


Download and install WSO2 WSAS-2.2.1 or later

Step 1

JMX port is disabled by default in WSAS. Open WSO2WSAS_HOME/conf/server.xml and uncomment the following element.

<!--The JMX Port-->

Step 2

Start WSO2 WSAS (run wso2wsas.bat or sh).

Make a note of the JMX url which will be printed on server startup console
i.e:- JMX Service URL : service:jmx:rmi:///jndi/rmi://YourHost:9999/server

Step 3

Start command prompt (or shell in linux), type Jconsole and hit enter. JConsole:Connect to Agent window will be popped up.

Enter JMX url (service:jmx:rmi:///jndi/rmi://YourHost:9999/server)
Enter admin as user name and password. Note that, any user with admin privileges can log in to JMX.
Click on Connect.

You will be directed to the summary page of Jconsole as follows.

Step 4

Click on MBeans tab. You will see the Mbeans tree in the left pane. Select org.wso2.wsas MBean.
ServerAdmin, ServiceAdmin and StatisticsService MBeans will be listed there.
Select ServerAdmin.

You will see shutdown, restart, restartGracefully, shutdownGracefully, startMaintenance and endMaintenance administrative functions when clicking on Operations tab in the above screen.

Step 5

We observed a few administrative function of WSo2 WSAS which were exposed through JMX in the above step. Lets see how service statistics are monitored using Jconsole.

Click on StatisticsService Mbean at the left pane. Next, select Operations tab.
Following screen will be displayed.

In order to check service statistics, we must invoke a service deployed on WSAS. Open your browser and enter the following URL.
This will send a HTTP GET request to the default Version service.

Now enter 'version' as the value of the getServiceRequestCount operation in above screen and click on getServiceRequestCount.
You will get '1' as the response.

Invoke Version service a few more times (just send http GET requests using the above URL).
Enter 'version' as parameter 1 (p1) and 'getVersion' as parameter 2 (p2) of getOperationRequestCount operation.
You will see a operation return value similar to the one bwlow.

Now, you will be able to proceed with more operations and get the statistics of server and system status.

Tuesday, August 26, 2008

How to avoid "java.security.InvalidKeyException:illegal Key Size" error when invoking secured services in WSO2 WSAS

"java.security.InvalidKeyException:illegal Key Size" error is a common issue which occurs when you try to invoke a secured web service in an environment where the provision for java unlimited security jurisdiction is not done.
This can be avoided by installing Java Cryptography Extension (JCE) unlimited strength jurisdiction policy files.

1. Suppose you are using jdk15. Go to http://java.sun.com/javase/downloads/index_jdk5.jsp

2. Go to the Other Downloads section and click on download link next to "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 5.0"

3. Download jce_policy-1_5_0.zip and extract it in to a directory.

4. You will find local_policy.jar and US_export_policy.jar files there in the extracted directory. Copy these two files to $JAVA_HOME/jre/lib/security directory. (These files will already be there. you may replace them)

5. Restart WSO2 WSAS and invoke your secured service again. You will not encounter the "invalidkeyException" any more.

Wednesday, August 20, 2008

Six different mechanisms to invoke a web service

I recently published a tutorial at WSO2 Developers portal - Oxygen Tank, which demonstrates six different mechanisms to invoke a publicly available web service.
This tutorial explains each mechanism using a set of simple steps and mainly focused on beginners to the web services.

See the complete tutorial here

Friday, August 8, 2008

How to deploy Apache Axis2 on GlassFish Application Server

I have demonstrated the steps to deploy Apache Axis2 on BEA WebLogic, IBM WebSphere, JBoss and Resin application servers in my previous posts. This series is not complete unless the steps to deploy Axis2 on GlassFish server are explained.
Lets see how Axis2 can be deployed on GlassFish server. It is quite straightforward and similar to the other application servers we have discussed so far.

Download and install the latest version of GlassFish server from here.

Step 1

Start GlassFish server.
i.e:- Go to GlassFish_Home/bin and run asadmin script as follows.
asadmin start-domain domain1

This will start GlassFish server in domain1.

Step 2

Download Axis2.war from here

Step 3

Access GlassFish administration console (In a browser, access http://localhost:4848).
Log in to administration console (Default username=admin, password=adminadmin).

Step 4

In the left navigation menu of the GlassFish admin console, select Enterprise Applications and click on Deploy.
You will be directed to the following screen.

Select 'Web Application(*.war)' as the Type from the drop down list.
Enter the location of the downloaded axis2.war.
Leave the other settings intact and click OK.

You will be directed to the "Web Applications" page.

Select Axis2 from the table and click on Launch.
Axis2 administration page will be displayed.

Step 5

Verify the status of installation. Click on 'Validate' link of Axis2 admin page. You should see the following 'Axis2 Happiness' page.

Now you can log in to Axis2 administration page and start deploying services.

Tuesday, August 5, 2008

How to use tcpmon inside Eclipse

Apache TCPMon is an utility that allows the messages to be viewed and resent. It is very much useful as a debug tool. If you don't know much about this tool, you can find more information here , here or here.

I found an extension of this great tool, which can be included as an Eclipse plugin so that developers can monitor message transmission within their workspace without opening a separate tcpmon instance. It is very cool indeed.

Saliya Ekanayake, a colleague at WSO2 has developed this utility as part of his university project. Lets see how this tcpmon plugin can be used in Eclipse WTP.

1. If you haven't done yet, download and install Eclipse WTP

2. Download tcpmonitor-1.0.0.jar from here

3. Copy tcpmonitor-1.0.0.jar in to Eclipse_home/plugins directory

4. Start eclipse

5. Select Window --> Show View --> Other --> Tcp Monitor --> TCP Monitor

6. Tcp monitor will be added as an view tab.

Now you can configure the necessary port settings and trace message transmission.