Social Icons

twitterfacebookgoogle pluslinkedinrss feed

Featured Posts

Sunday, September 14, 2014

Customizing Header and Footer of WSO2 API Manager Store

If you want to customize the header and footer of WSO2 API Manager Store application, this blog post will be explaining how to do that by adding a subtheme. 

Adding a Subtheme

1). Navigate to "\repository\deployment\server\jaggeryapps\store\site\themes\fancy\subthemes" directory.
2). Create a directory with the name of your subtheme. Here I am going to create a subtheme called "test"
3). Edit "repository\deployment\server\jaggeryapps\store\site\conf\site.json" file as below. This makes your sub theme as the default theme.

"theme" : {
        "base" : "fancy",
  "subtheme" : "test"
Customize Header:

As an example, Here I am going to remove theme selection menu item from store header (theme selection will be appearing after user login into the store).

1). Create a directory called "templates" inside your subtheme directory.
2). Copy "template.jag" located in "\repository\deployment\server\jaggeryapps\store\site\themes\fancy\templates\user\login" 
into your new "templates" directory with the same "templates\user\login" directory structure.
3). To remove theme selection menu item, remove "<li class="dropdown settingsSection">...</li>" HTML tag section from the "template.jag". 

Customize Footer:

Here I am going to Remove documentation hyperlinks available in the API Store footer

1). Create a directory called "templates" inside your subtheme directory. Ignore this step if you have already done with the "Header customization"
2). Copy "template.jag" located in "\repository\deployment\server\jaggeryapps\store\site\themes\fancy\templates\page\base" 
 into your new "templates" directory with same "templates\page\base" directory structure.
3). To remove Docs link, you can find them inside the "row-fluid" div tag. Customize them according to your requirements.

Thursday, August 28, 2014

Host name verification failed for

Are you getting a " Host name verification failed for host" exception as below while trying to connect with a different host? 

TID: [0] [AM] [2014-08-28 14:41:51,936] ERROR {org.apache.synapse.transport.passthru.TargetHandler} - I/O error: Host name verification failed for host : {org.apache.synapse.transport.passthru.TargetHandler} Host name verification failed for host : at org.apache.synapse.transport.http.conn.ClientSSLSetupHandler.verify(
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$

Reason is hostname verification is set to Default. So in order to get rid of this issue, modify the axis2.xml(https - transportSender) to turn Hostname Verification off as below.

&lt;parameter name="HostnameVerifier">AllowAll</parameter>

More Information about HostnameVerifier.

Saturday, June 07, 2014

WSO2 Governance Registry - Monitor database operations using log4jdbc

LOG4JDBC is a Java based database driver that can be used to log SQL and/or JDBC calls. So here I am going to show how to monitor JDBC operations on Governance Registry using log4jdbc.

Here I believe you have already configured Governance Registry instance with MySQL. If not, please follow the instruction available in the Governance Registry documentation.

1). Download the log4jdbc driver

 You can download log4jdbc driver from below location:

2). Add log4jdbc driver

 Copy log4jdbc driver into CARBON_HOME/repository/components/lib directory.

3). Configure file.

Navigate to file located in CARBON_HOME/repository/conf/ directory and add below entry in to file.

# Log all JDBC calls except for ResultSet calls

# Log only JDBC calls to ResultSet objects

# Log only the SQL that is executed.

# Log timing information about the SQL that is executed.

# Log connection open/close events and connection number dump

# the appender used for the JDBC API layer call logging above, sql only
log4j.appender.sql.layout.ConversionPattern=-----> %d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%n

# the appender used for the JDBC API layer call logging above, sql timing
log4j.appender.sqltiming.layout.ConversionPattern=-----> %d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%n

# the appender used for the JDBC API layer call logging above
log4j.appender.jdbc.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n

# the appender used for the JDBC Connection open and close events
log4j.appender.connection.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n

4). Update the master-datasources.xml file

Update the master-datasources.xml file located in CARBON_HOME/repository/conf/datasources directory. There each datasource URL and Drivers as below


5). Enjoy

Some database drvers may not support by default(ex :db2), there you can pass database driver name as VM argument

Restart the server and enjoy your work with log4jdbc. Log files are created under CARBON_HOME/repository/logs/ directory. So using sqltiming.log file you can monitor execution time of each query.

PS : If  you want to simulate lower bandwidth situation, you can use trickle when the server is starting.
         Example sh trickle -d 64 -u 64

Friday, February 14, 2014

WSO2 Governance Registry - Apply Tags using Handler

There can be scenarios, where users want to apply tags into their resources, while resource is inserted. I am writing this post based on my answer provided to this Stack Overflow question.

Question was on how to apply a tag into a service in WSO2 Governance Registry at the time of the service creation. We can use Registry Handler for achieving this requirement. Handlers are the well-known extension points in WSO2 Governance Registry.

"Handlers are pluggable components, that contain custom processing logic for handling resources. All handlers extend an abstract class named Handler, which provides default implementations for resource handling methods as well as a few utilities useful for concrete handler implementations."[WSO2 Governance Registry Docs]

I have modified handler sample, which is shipped with Governance Registry pack. Using above link please download the G-Reg pack and handler sample is located at GREG_HOME/samples/handler.

public void put(RequestContext requestContext) throws RegistryException {

 if (!CommonUtil.isUpdateLockAvailable()) {
        try {
   String resourcePath = requestContext.getResourcePath().getPath();
   Registry registry = requestContext.getRegistry();
   registry.applyTag(resourcePath, "CustomTag");

  } finally {

Compiled jar file need to be added into GREG_HOME/repository/components/dropins folder and register handler using either management console or registry.xml file.

<handler class="org.wso2.carbon.registry.samples.handler.CustomServiceHandler">
    <filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
        <property name="mediaType">application/vnd.wso2-service+xml</property>

When you are inserting a new service, this handler will get hit and it will add the given tag into the Service.