Posts

Showing posts from May, 2014

Java Mail network is unreacheable connect exception

Recently I stumbled upon a weird problem while debugging a simple java application that needed to send an emailSince I was debbuging this application locally I used the FakeSMTP tool that I described in this tutorial here : Testing email sending functionality with FakeSMTP which I run locally on my machine So after editing the configuration on my Java program and firing up the SMTP server I was quite surprised to get the following exception : Caused by: javax.mail.MessagingException: Could not connect to SMTP host: 127.0.0.1, port: 25 (java.net.SocketException: Network is unreachable: connect) System.setProperty("java.net.preferIPv4Stack" , "true"); So once you are sure you problem is not coming from a non running SMTP server or a network connection, you can check if the culprit is no other than JavaIf you read the Oracle documentation here you will see that by default Java prefers IPv6 to IPv4 which is the problem in our case since FakeSMTP binds on IPv4Luckily…

Heroku PostgreSQL and DBVisualiser connection using SSL

Image
I occasionally use Heroku to deploy webapps on the cloud combined with a Postgres database to store my relational dataI recently found a multi-platform polyglot SQL client that I could use with my MAC, this product is called DbVisualiserHowever since Heroku requires an SSL security on external connections after providing the usual database connection properties (url, username, password) when I tried to connect through DbVisualiser I was getting the error message : FATAL: no pg_hba.conf entry for host "86.200.9.63", user "u4b1uljsil33m2", database "de9td8cv06p4se", SSL off After playing a bit with the different options and reading the Postgres JDBC driver over here I found out that you can provide an Non Validating SSL factory in the connection properties to satisfy Heroku's SSL requirements In order to configure the SSL properties in DbVisualiser you need to edit the following SSL properties in the Properties tab : SSL : truesslfactory : org.postgres…