Tuesday, February 12, 2013

WSO2 ESB NativeWorkerPool Error

Are you getting the NativeWorkerPool uncaught exception, and is unable to determine why this happens in WSO2 Enterprise Service Bus (ESB). If so, read on. There can be several issues that could lead to NativeWorkerPool exception. So, to determine the actual cause for this, you should read the remaining stack trace. 

For example, you may see an exception like the following. [1] There, if you read the third line, you'll notice that it says ...synapse.endpoints.IndirectEndpoint.readyToSend(...). If your stack trace also shows that, then error issue here is quite simple. First of all, we can determine you are using load balance endpoint since it's trying to determine an actual endpoint to send the request to. So, open up your proxy service and get to know what are the actual endpoints that it uses to load balance. 

Make sure that all the endpoints specified there exists. There may be a type between the endpoint name, and reference you specified inside the proxy service. The below error happens due to this reason.


[1]
ERROR - NativeWorkerPool Uncaught exception 
java.lang.NullPointerException 
        at org.apache.synapse.endpoints.IndirectEndpoint.readyToSend(IndirectEndpoint.java:74)         at org.apache.synapse.endpoints.algorithms.RoundRobin.getNextEndpoint(RoundRobin.java:100) 
        at org.apache.synapse.endpoints.LoadbalanceEndpoint.getNextChild(LoadbalanceEndpoint.java:274) 
        at org.apache.synapse.endpoints.LoadbalanceEndpoint.send(LoadbalanceEndpoint.java:105) 
        at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:87) 
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60) 
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114) 
        at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154) 
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181) 
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) 
        at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408) 
        at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259) 
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
        at java.lang.Thread.run(Thread.java:662) 

Sunday, January 20, 2013

How to remove a child from Axiom object model


Just wanted to point out that there is a difference in API of removing a child between Axiom and DOM. The API of removing a child from a xml tree is different between Axiom and DOM. In DOM, we do following to remove a child.

childNode.getParentNode().removeChild(parentNode);

where childNode is an org.w3c.dom.Node instance.

Basically, what the above does is, when you want to remove a node from a document, it gets the parent node, and then calls the #removeChild to remove the given node from parent.

With Axiom, it's different. What we do is get the child node, and remove it's parent reference. For example,

            element = omFactory.createOMElement(name, null);
            OMElement element = (OMElement) xpathExpression2.selectSingleNode(documentElement);
            element.detach();

Wednesday, October 31, 2012

[WSO2] Deployment Synchronizer for Artifact Synchronization Between the WSO2 Cluster Nodes - Webinar slides

I and Pradeep did a webinar on Deployment Synchronizer feature of WSO2 products with focus on practical aspects with a demonstration on setting up a minimal wso2 cluster setup w/ Deployment Synchronizer enabled. This covers most of the details that are needed to know on this subject. I did the Demonstration while Pradeep Fernando covered the technical aspects.

You can view the slides from below.




You can see the details on this webinar at - http://wso2.org/library/webinars/2012/10/enterprise-use-case-webinar-wso2-depsync-data-synchronization-between-nodes-cluster/

The abstract goes as -

Setting up a cluster is important when developing enterprise software and deploying them in production environments. Distributing deployment artifacts & related metadata to all nodes in a homogeneous cluster is a typical requirement for a clustered deployment of any middleware platform. In such a cluster, all nodes should contain the deployed artifacts as well as the related metadata.

The Deployment Synchronizer (DepSync) is the mechanism used in the WSO2 platform for distributing these artifacts and metadata across all nodes in the cluster. It provides the ability to synchronize data between the worker nodes of a product cluster. When used with the WSO2 Application Server, or the WSO2 ESB, you can synchronize your deployable artifacts like web services, and web applications etc. across the cluster nodes. In addition, with the latest WSO2 Carbon 4 release, WSO2 provides the ability to synchronize service metadata which includes service policies, transports, and service-type specific data. Now you only have to deploy and configure services in one node - called the manager. Then, DepSync will replicate those to other nodes - workers.

In this webinar, we will present how this is done in the WSO2 Cloud-enabled middleware platform. Typical deployment artifacts will include webapps, JAXWS/JAXRS apps, data services, proxy services, and BPEL processes . The WSO2 platform also natively supports multi-tenancy. Tenants & tenant artifacts are loaded on demand. We will demonstrate how DepSync works efficiently with multi-tenancy.

Make sure to join Kasun Gajasinghe and Pradeep Fernando as they introduce DepSync which reduces the complexity of configuration management of a clustered deployment, and provides a consistent way to synchronize the cluster with zero downtime.




Monday, October 8, 2012

Clear QPid/Andes/Cassandra JMS Queues



This tutorial shows how to clear the JMS queues of Cassandra. It should be noted that this method clear all the queues; you can't clear queue of your selection. This is useful where you have sent a message, and while it's in the queue something went wrong. There could be errors in processing the message due to incorrect settings etc. Since the queues are accessed FIFO (First-In-First-Out), if a message is hanged in the queue, it'll also block all other messages in the queue because they waits until the first message is processed.

At WSO2, we use WSO2 Message Broker to connect with Cassandra via WSO2 Andes (extended version of QPid) while WSO2 ESB will utilize these to maximum use. Message Store and Message Processor mediators that comes with WSO2 ESB uses JMS queues extensively.


  • Shutdown all the servers if they are running
  • Open up Cassandra-HOME/conf/cassandra.yaml
  • Remember the log locations you have set. Typically, you would have set 
    • data_file_directories
    • commitlog_directory
    • saved_caches_directory
  • Delete all three files folders. (By default, these locations point to relevant child folder in Cassandra-HOME/logs/cassandra/)
It's all set. Now, start the cassandra and other servers. The queues will be cleaned. Actually, what  happens during this process is that it removes all the queues. When the servers start, they re-create the missing queues. That should be it! :)

Thursday, October 4, 2012

Carbon 4.0.0 - JMS Address endpoint URL format


This applies when you are using WSO2 ESB 4.5.0+ and WSO2 MB 2.0+. In WSO2 Message Broker 2.0, we use Andes as the message broker, an extended version of QPid.

The format to use when defining a JMS endpoint is like follows. Remember The configuration will be different if you are not using Andes.


jms:/MaterialMasterProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue



If you are want to create an address endpoint with JMS in WSO2 ESB 4.5.0, then it will look following.



 <endpoint name="MaterialMasterProxyEndpoint">
     <address uri="jms:/MaterialMasterProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/jndi.properties&amp;transport.jms.DestinationType=queue"/>
  </endpoint>


In ESB 3.0.1, we defined the address endpoints as follows.

jms:/MaterialGroupsProxy1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=tcp://10.200.3.117:5682&amp;transport.jms.DestinationType=queue&amp;java.naming.provider.url=repository/conf/server.properties




Tuesday, October 2, 2012

[Linux] Copy files faster cp command


Every Linux user is familiar with file copy command, cp (copy). As an user who uses this frequently in a day, I can't help but wonder about possible alternatives to cp. CP is terrible when copying large number of files that are small in size. So, after digging in the internet, I found the following command to be a little more faster than cp command when it comes to copying smaller files.




tar cf - dir1 | (cd dir2; tar xf -)

With this, you can move an entire directory from dir1 to dir2. Here's an example.




tar cf - images/ | (cd /media/gentoo_/images/ tar xf -)


Monday, September 17, 2012

HOW TO INSTALL VLC 2.0 IN UBUNTU 11.10


Did you know that the latest VLC player version they can get is 1.1.12?  As of today, the most recent version available is 2.0.4 which is able to install from Ubuntu 12.04. So, VLC users have to either have to upgrade Ubuntu version, or be stick with an older 1.x versions.

But there is a way to install VLC via a PPA from VLC Daily Build of master branch. It's ppa:videolan/master-daily . I first tried ppa:n-muench/vlc, but it never worked for me. This worked flawlessly. The technically savvy people may now go ahead and install VLC by using this PPA. Others or if you are just interested, follow the instructions below to get it installed.

First enter the following command to add this PPA to your software sources


sudo add-apt-repository ppa:videolan/stable-daily


Now, you can update your software indexes, and install VLC.


sudo apt-get update && sudo apt-get install vlc


Now, you have a nice looking VLC at your hand. They say the performance is improved too among other new features. But I'm yet to test those! :-)