Friday, October 20, 2017

org.hibernate.HibernateException: Error accessing stax stream

Couple of things you should check: 
  • If you are using Eclipse IDE make sure that it is not giving you any error indicators for hibernate.cfg.xml file. 
  • Make sure to close the tag <hibernate-configuration>
  • Missing !character in the DOCTYPE
  • Not able to accesshibernate-configuration-3.0.dtd from the url provided.
  • Space before <?xml version='1.0' encoding='utf-8'?>

Docker: Error: Unauthorized: incorrect username or password on mac OS

Getting the following error when I run anything... 


docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/latest: unauthorized: incorrect username or password

Here is how I solved it: 
  • Login into www.docker.com with my username and password
  • Note down the docker ID which is different than your loginID/email 
  • In Terminal now enter the command "docker login" it will ask you to enter your user and password
  • If the login is successfull you should get the following message: 

Password: 
Login Succeeded

Now you can run the commands and they should run fine. 

Wednesday, October 18, 2017

What is Hibernate?


It is an ORM Framework to develop persistence logic. It is: 


  • Opensource 
  • Lightweight
  • Provides abstraction over JDBC
  • No need for any containers (jsp, servlet etc etc). 
  • Supports POJO and POJI model programming
  • Can be used individually as well as other technologies like Spring etc 
  • Does not require you to implement any Hibernate API interfaces & neither it requires you to extend any hibernate clases. Hence we can say it is a loosely coupled framework
  • Allows us to develop Object Based Persistence logic and hence it is called ORM framework
  • Can change from one DB software to another without having to change any Objects etc
  • Transaction management, locking, caching etc is all in-built. 









JDBC Limitations or Problems



  • Changing DB Software is too complex since JDBC code is Database software dependent and is not at all portable. 
  • Programmers need to convert Object notations to DB columns and visa versa. 
  • Exception handling is mandatory and nothing is in built
  • Versioning and time stamping are not provided out of the box. Need to program and handle them manually. 
  • No proper transaction management support. 
  • Does not support Object level relationships like we have table relationships.
  • Too much boiler plate code (repeated code) needs to be written. 






Saturday, October 14, 2017

Concepts of Coding in AWS Lambda


Languages supported (as on Oct 2017): 
C#, Java 8, Node.js (4.3 & 6.10), Python (2.7 & 3.6). 

Coding Pattern/Syntax: There are 4 main components we need to remember

Handler This is your main function which will be called by AWS Lambda when execution starts. All of the event data is been passed to this handler function as the first parameter. The handler processes the event data and may invoke other methods or functions in your code. 

Context This is the second object passed to the lambda function. This is used by our code to interact with AWS Lambda. For e.g., you can figure out the execution time that remains. In node.js there are additional methods available that allows callback. 

Logging AWS Lambda writes logs to CloudWatch

ExceptionsYou can throw or raise exceptions which AWS lambda will pass on to the caller.


AWS Cognito: ErrorNotAuthorizedException: Unable to verify secret hash for client 7cakk6gknpt4cvqifdfbt9qm91


To get rid of this Error uncheck "Generate Client Secrets" when you create the App Client in AWS Cognito. That should solve the problem. Atleast that solves it for me.