Social Icons

twitterfacebookgoogle pluslinkedinrss feed

Featured Posts

Wednesday, October 08, 2014

Maven excludes all transitive dependencies

"Transitive dependencies are a new feature in Maven 2.0. This allows you to avoid needing to discover and specify the libraries that your own dependencies require, and including them automatically."

I had a problem, where some dependencies were available in the run time, but they weren't available in the public nexus repositories. For an example, Hibernate depends on the Sun JTA API JAR and it is not available in the central Maven repository because it cannot be freely redistributed. So when building the project, it was trying to download transitive dependencies and got failed.

So I looked  a way to ignore all the transitive dependencies, and found that we can ignore all the associated dependencies of a given dependency. There we can exclude all transitive dependencies without specifying groupId and artifactId of the dependencies. So need to use astric(*) character as groupid and artifactid of the dependency.


This wildcard transitive dependencies ignoring is available with maven 3.2.1 release. So it's worth to upgrade into latest maven version.

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 "&lt;li class="dropdown settingsSection"&gt;...&lt;/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