Monday 26 August 2019

java.security.cert.CertificateException: No subject alternative names present

I was going through 2 way SSL in springboot. I have made all correct configuration service tomcat server and service caller RestTemplate. but I was getting error as "java.security.cert.CertificateException: No subject alternative names present"

After going through solutions, I found, JVM needs this certificate otherwise it gives handshaking error.

Now, how to add this to JVM.

go to jre/lib/security/cacerts file. we need to add our server certificate file to this cacerts file of jvm.

Command to add server cert to cacerts file via command line in windows.

C:\Program Files\Java\jdk1.8.0_191\jre\lib\security>keytool -import -noprompt -trustcacerts -alias <alias_of_ssl_cer_file> -file   <path_of_ssl_cert_file.cer> -keystore <path_of_jdk_cacerts_file>-storepass changeit

Check server cert is installed or not:

C:\Program Files\Java\jdk1.8.0_191\jre\lib\security>keytool -list -keystore cacerts

you can see list of certificates installed:







How to kill already bind port process in windows

When we start our application on already running port, we get port already bind error.

Resolution: for ex. I want to find PID associated with port 8083 and and want to kill process associated with it. go with below steps:


1. go to command line
2. Find process associated with port

C:\Users\sachin.rane>netstat -ano | findstr :8083
  TCP    0.0.0.0:8083           0.0.0.0:0              LISTENING       7576
  TCP    [::]:8083              [::]:0                 LISTENING       7576


3. kill the process

C:\Users\sachin.rane>taskkill /PID 7576 /F
SUCCESS: The process with PID 7576 has been terminated.

Screenshot:




Congratullations!!Its done!!

Monday 19 August 2019

Install Docker on Windows


Docker in Windows

As we know, Docker is different than hypervisors (Virtual machines) and it uses Linux kernel internally, Docker will need Linux virtual machine on windows, so that it will work on windows as well. Docker provides ‘DockerToolbox’ which provide Virtual box component (by oracle corporation). For windows, Docker use this VM internally to have Linux kernel for its operation.
For Linux, No VM needed as it already having Linux kernel.

Docker toolbox download URL


Once you download, you will see exe file(DockerToolbox.exe) downloaded approx. 211 MB in size.

Installation Screenshots:


Double click on DockerToolbox.exe.





Click on Next button.

Click on Next button.
Check on required checkboxes. Better check all checkboxes.
Click on Install button.

Wait till above installation finished. It will extract and install above checked components.
It may ask to install, ‘Oracle Corporation Universal serial bus’ driver software(It is required for virtual box installation.). Install it.

Click on install button.
Once All things are installed, you will see below window.

Click on finish button. Once finished, you will see 2 shortcuts shown in the file explorer.



Click on ‘Docker Quickstart Terminal’ shortcut Or you can go to it via Windows Start button à Docker Quickstart Terminal.

Windows OS may ask to accept ‘VirtualBox Interface’. Accept it.
Once all installation finished, you will see docker thumbnail on terminal window.

Type ‘docker version’ and you can see all installed docker component versions as shown below:



Congratulations!!! Your Docker setup is successfully done!



Extract error records while inserting into db table using JDBCIO apache beam in java

 I was inserting data into postgres db using apache beam pipeline. it works perfectly with JdbcIO write of apache beam library. But, now, i ...