Posted by Editor | 9/18/2016 06:02:00 pm | 0 comments »
Recently while working on a Java + Spring + Hibernate + MySQL project I encountered a weird exception "java.sql.SQLException: Zero date value prohibited"!

As usual I did a quick search on Google but to my surprise Google did not return any result!

First I was scared, thought troubleshooting would be difficult. Upon closed analysis of the issue, this came out to be a silly data issue!

org.springframework.dao.TransientDataAccessResourceException: Hibernate operation: could not execute query; SQL [select field1, field2, field3 from table1]; Zero date value prohibited; nested exception is java.sql.SQLException: Zero date value prohibited.

I had a date column where the entries were '0000-00-00', just nullified the entries and the error went away!
Continue reading...

Posted by Editor | 9/06/2016 09:13:00 pm | 0 comments »
Getting the error "Failed to retrieve account attributes, certain console functions may be impaired" while trying to create a new RDS instance or while rolling up a new EC2 instance?

Don't worry, you are not alone. There are various reasons for this error to occur, sometimes due to missing permissions, sometimes due to account setup issues.

If you are getting this error on a new aws account, just wait for 2 to 8 hours, your account setup is not yet complete. And the reason could be the $1 auth on your credit card is not yet done. Just wait and re-try, you would be able to use your account without any issues.

If you are getting the error with an existing account, the error could be due to lack of permissions in access policies to the actions invoked by the the console. To fix this error, the IAM admin should provide necessary roles to the IAM user. Say for example you are getting error while setting up ElastiCache, add ec2:DescribeAccountAttributes and ec2:DescribeSecurityGroups roles to the IAM user.

Still having issues? Feel free to provide the details here or contact aws support.
Continue reading...

Posted by Editor | 7/18/2016 11:57:00 pm | 3 comments »
Pokemon or Pokémon Go, a trending game from Nintendo is not yet launched in India, still you can install and play the game on your Android phone. Want to know how?

Since Pokemon Go is not launched in India, you will not be able to see it in the Google Play Store. You can download the apk from third party sites but it is not advised to do so as those would contain malware which would steal your data and even corrupt your phone. We strongly recommend to use a VPN tunnel and download the game from Google Play Store itself.

First you need to install a VPN client such as 'TunnelBear' on your device. It is freely downloadable from Google Play. Once installed, open the application and select "United States" as target location from the drop-down and then activate VPN. This will change the location of your phone to US.

Now go to Google Play Store and search for "Pokemon Go". If the game is not listed, go to Settings->Apps->Google Play Store and clear the data and cache. Then re-launch Google Play, you will have to accept the terms and conditions once again as you have cleared the app data. Repeat the search, you will see "Pokemon Go" in the search result, download and install it on your device.

Now you can turn off the VPN and may uninstall TunnelBear. Open "Pokemon Go" and enjoy the game. As always, "Remember to be alert at all times. Stay aware of your surroundings"!

How to get more PokéBalls?

Of course the easiest way to get more PokéBalls is to spend PokéCoins by shelling out some bucks but that's not fun. You level up fast and fill up your Pokédex, each level up will give you a good number of Pokéballs. Another option to get more Pokéballs is to visit nearest Pokéstops. When you are near a Pokéstop, touch the blue icon which will give you details about that Pokéstop. Just spin the wheel to earn more Pokéballs and other items like PokéCandies.

My PokéBall freezes while trying to catch Pokémon, what to do?

This is happening with almost everyone intermittently. This could be a network/server issue. You just wait for the PokéBall icon on the top left corner to disappear, it's most likely that you will get your Pokémon in your Pokédox after restarting the game!
Continue reading...

Posted by Editor | 2/24/2016 11:31:00 pm | 4 comments »
Service oriented architecture(SOA) separated the business logic from presentation layer, then comes IoT(Internet of Things) which need the services to be served to multiple clients such as web, Mobile and middle-ware applications. Also, the Cloud Computing Architecture made application developers life easier by providing highly scalable and reliable infrastructure.

But when the business grows, business complexity also grows and the services exposed also becomes non-maintainable. Your code becomes too complex; continuous delivery, testing, scaling - all becomes difficult. Micro-service architecture solves this problem by breaking down business functionalities into small, highly scalable, loosely coupled services called micro-services which runs in parallel.

Since the services are completely independent, the code will be clean, testable and maintainable. Also, the developers can independently work on the services, can independently test the features, can do continuous delivery without affecting other running services(must be backward compatible). When it comes to scalability, micro-service architecture gives you complete freedom in scaling individual services on increase in load.

No doubt, micro-service architecture is the future of enterprise software development. You can build micro-services in any technology you like and deploy them on your favorite application server running on private or public cloud(aws, azure, google cloud etc.). Also some cloud service providers provides Platform as a Service(PaaS) where they will take care of the capacity provisioning, load balancing, auto-scaling, and application health monitoring(e.g. Amazon Elastic Beanstalk, Google App Engine etc.). Amazon went ahead and provided one more platform where you don't even have to think of infrastructure or platform at all, all you need to do is, write your code and upload to aws! Yes, aws Lambda makes it possible to run a piece of code driven by events or by HTTP requests. Lambda takes care of provisioning and managing the servers and also takes care of auto-scaling, monitoring and logging.

In this article, you will learn how to build highly scalable micro-services using Java 8, AWS Lambda and AWS API Gateway. You should have an active AWS account, basic knowledge on various AWS services, understanding of RESTful(REpresentational State Transfer) services and of course basic Java coding skills.

DynamoDB Database Setup

First we will setup a DynamoDB table where we can insert, update delete records. Go to DynamoDB section in aws console and create a table named "product". Add "sku" as primary key(partition key), leave all other settings as default and click on "Create". Now let's insert a new item, for this, go to Items tab and click on "Create Item". Select "Text" from the drop-down and paste the below json content in the area provided, then click on "Save".

  "Sku": "SKU00001",
  "Name": "Apple iPhone 6",
  "ImageUrl": "",
  "ShortDescription": "Short Description",
  "LongDescription": "Long Description.",
  "Price": "699.99"

Writing business logic

We will simply read product details from DynamoDB and return the result back to the caller. Create a maven project and add dependencies for lambda and dynamodb, your pom.xml will like like this:

<project xmlns="" 

Now, we need the domain class, say as below:

package com.texient.ecommerce.model;

public class Product {
 private String sku;
 private String name;
 private String shortDescription;
 private String longDescription;
 private String imageUrl;
 private String price;
 public String getSku() {
  return sku;
 public void setSku(String sku) {
  this.sku = sku;
 public String getName() {
  return name;
 public void setName(String name) { = name;
 public String getShortDescription() {
  return shortDescription;
 public void setShortDescription(String shortDescription) {
  this.shortDescription = shortDescription;
 public String getLongDescription() {
  return longDescription;
 public void setLongDescription(String longDescription) {
  this.longDescription = longDescription;
 public String getImageUrl() {
  return imageUrl;
 public void setImageUrl(String imageUrl) {
  this.imageUrl = imageUrl;
 public String getPrice() {
  return price;
 public void setPrice(String price) {
  this.price = price;


Let us implement the business logic in a lambda request handler class as follows:

package com.texient.ecommerce.service;

import com.texient.ecommerce.dynamodb.ProductDelegate;
import com.texient.ecommerce.model.Product;

public class GetProductImpl implements RequestHandler{
 public Product handleRequest(Product product, Context context){
           context.getLogger().log("Input: " + product.getSku());
           product = ProductDelegate.get(product.getSku());
           if(product!=null) {
         context.getLogger().log("Returning product details");
         return product;
         throw new RuntimeException("404");

Creating a Lambda Function

Let's create a Lambda function which will execute the handler method we implemented earlier via API Gateway. In REST world it is a GET endpoint, say /product/{sku} which will return the product details of {sku}. Go to Lambda tab in aws console and click on "Create a Lambda Function". Select "microservice-http-endpoint" blueprint, provide name as "GetProduct" and select "Runtime" as "Java 8". Provide S3 url(or upload jar file) for your Lambda function code, enter handler as "com.texient.ecommerce.service.GetProductImpl::handleRequest" and select a role which has complete access to S3, DynamoDB and Lambda. Leave all other fields as default and click on "Next".

On next page we will setup the API endpoint, provide API name as "ProductService", Resource anme as "/product", method as "GET", stage as "Prod" and security as "Open"(for time being). Click "Next", review the details and click "Finish". This will create a new Lambda function "GetProduct" and an end point which points to the newly created Lambda function.

Setting up API Gateway

If you open the API Gateway tab in aws console, you will see an API already created for you by the "microservice-http-endpoint" blueprint. Click on /product and then Create Resource button, provide "Sku" as resource name and {sku} as path param. Create a "GET" method under /product/{sku}, click on it and then in the Integration Request, select integration type as Lambda Function and select the lambda function you created in the earlier step. Add a new mapping template "application/json", then fill the template with the below json:

    "sku" : "$input.params('sku')"

Also you can use the below shortcut to map all your query parameters to Lambda parameter "query":
    "query": "$input.params().querystring"

We are all set to test the API end point. On the left side you will see a "Test" button, click on it and provide "SKU00001" for sku and hit "Test" button. A console will appear on the right with the log, where you can see the response body and response status. If you have followed the steps as mentioned above, you will get a 200 response with the product details in the response. In the log section you will see the debug log, input to the Lambda function, and the transformed output.

Publish the API

So we have an API endpoint pointing to the Lambda function; to invoke it from a REST client, you need to deploy the API. On top left there is a "Deploy API" button, hit on it, the API is deployed and you will get an endpoint similar to You can now do a GET for sku SKU00001 by invoking the url


We implemented and deployed a highly scalable RESTful micro-service with AWS Lambda and API Gateway without even thinking of application servers nor on load balancers. AWS takes care of provisioning of compute units and auto-scaling. Also, aws provides options to cache the responses, which heavily decreases the processing time and thus response time. In our test, we noticed initial request taking more response time, subsequent requests are served incredibly fast, could be due to provisioning of resources. Also you will have to do an error mapping to return correct HTTP status code, which is completely manual. Apart from these, we feel API Gateway + Lambda stack is a super simple but extremely powerful tool for building enterprise level micro-services. For existing services, you can simplify migration by importing the Swagger documentation, API Gateway creates all end points and models defined in the documentation, you just need to create Lambda functions and associate them with the end points.

Continue reading...

Posted by Editor | 1/12/2016 09:35:00 pm | 0 comments »
My Samsung Smart TV recently started behaving strangely, I can change the channels, increase/decrease volume, access TV menu and change settings, no issue at all. The problem starts whenever I start the Samsung Smart Hub app!

If I open the browser on TV, the pointer moves a little bit and stops responding for few seconds. Again it moves a little bit and then stops, really irritating. Same with YouTube app, the pointer is totally unresponsive but I can use the arrow keys to control the video or to type using the on-screen keyboard.

I did a lot of research, many asked to go close to the TV and operate the remote, some suggested to remove the batteries, then while holding the power button, replace the battery by pressing and holding the power button, but none worked for me. Also I tried turning the power off for few minutes, then turn it on, also did factory reset, nothing worked.

I read somewhere(in CNET forum) it is a hardware/firmware issue which Samsung could not fix till now but in my case it was working before with no issue at all, even there were no software updates recently, so definitely it is not an existing hardware/software issue. Some people reported, their issue got fixed when they connected the TV to internet via Ethernet, claiming the bandwidth used by the remote is conflicting with the wifi etc, still the question in my mind was, how this was working before?

Finally I decided to contact Samsung customer support, just before dialing, my wife suggested putting new batteries in the remote, I removed the Korea made "Rocket" batteries and put brand new Energizer batteries, you won't believe, the remote started working as before!!!

So, it was all because of weak batteries, the pointer was not responding. Some people reported the remote responds when the move close to the TV, this confirms weak signal from the remote due to weak batteries. Not sure how it worked for few when they connected their TV directly via Ethernet, could be they were operating the remote very close to the TV while testing. Anyway, if you are facing similar issue, first replace your remote batteries with new high power batteries and check if it is working, if not contact the customer support.
Continue reading...

Posted by Editor | 10/06/2015 11:20:00 pm | 0 comments »

Follow the below steps if you want to preserve the namespace prefix values consistent.

First define a namespace prefix map, say JAXBNamespacePrefixesMap as below:

<util:map id="JAXBNamespacePrefixesMap">
   <entry key="" value="ns1" />
   <entry key="" value="ns2" />
   <entry key="" value="ns3" />
   <entry key="" value="ns4" />
   <entry key="" value="ns5" />

Now set this map as namespacePrefixes in JAXBElementProvider.

<bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
   <property name="jaxbElementClassMap" ref="JAXBElementClassMap" />
   <property name="marshallAsJaxbElement" value="true" />
   <property name="unmarshallAsJaxbElement" value="true" />
   <property name="collectionWrapperMap" ref="JAXBElementClassMap" />
   <property name="namespacePrefixes" ref="JAXBNamespacePrefixesMap" />

In the server configuration you will have jaxbProvider as a provider.

<jaxrs:server id="CXFService" address="/" >
      <entry key="json" value="application/json" />
      <entry key="xml" value="application/xml" />
      <ref bean="CXFServiceBean"/>
         <ref bean="jaxbProvider" />
         <ref bean="jsonpProvider" />            
       <ref bean="jsonpInInterceptor"/>
        <ref bean="jsonpOutInterceptor"/>

That's it! You will see the namespace prefix as defined in the mapping.

<ns1:person xmlns:ns1="" xmlns:ns2="" xmlns:ns3="" xmlns:ns4="" xmlns:ns5="">
      <ns4:address>Your address</ns4:address>
Continue reading...

Recommended products