Skip to main content

Posts

Fixing 'java RMI - ConnectException: Operation timed out' in WSO2 Enterprise Integrator 6.4

If you ever come across the below exception when running WSO2 Enterprise Integrator 6.4, here is the fix. This error occurs when you have multiple IP addresses from different networks configured in your etc/hosts as below. 10.xxx.x.xxx localhost 192.xxx.x.xxx localhost So simply, removing the unnecessary one and leaving the one of the network that you are currently connected to should resolve this issue. 10.xxx.x.xxx localhost
Recent posts

Exception Handling with Spring Boot Application

Exception and error handling is one of the most crucial when it comes to web service. It is also the most important as the correct respond should be given to the service consumer. This is not an easy task. You may have to code a wrapper class for error handling. But with spring boot this has become very easy. This blog post is about how a thrown exception can be handled as the response. METHOD 1: package com . example . project . exceptions ; import org.springframework.http.HttpStatus ; import org.springframework.web.bind.annotation.ResponseStatus ; @ResponseStatus ( value = HttpStatus . NOT_FOUND , reason = "No such Movie" ) public class MovieNotFoundException extends Exception { } The exception class must be annotated with @ResponseStatus. This defines the response to be returned when the exception is thrown. So if the controller is as follows, package com . example . project . controllers ; import com.example.package.models.Movie ; i

A noob Introduction to creating a REST API using Spring Boot and MongoDB

Intro This post is a beginner's guide to getting started with creating a simple REST API within seconds using Spring Boot and MongoDB. Contains all basic CRUD operations. Few confusions I faced as a beginner was when packaging was done and Spring Boot could locate several components. So this blog post will follow the standard packaging alongside the implementation. For further understanding of the annotations to be used, [1] and [2] can be referenced Prerequisites  Maven MongoDB setup Code Step 1 : Initiate maven directory structure |__src          |__main                      |__java                                 |__com.example.project                      |__resources         |__test Initiate the pom.xml as below. Here, the mongoDB dependency is added as well. <?xml version="1.0" encoding="UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.

Weather Monitoring Station using Java Sockets and Java RMI

Introduction This system is a weather monitoring system for mobile base-stations around the country. It uses sensors that can measure temperature, air pressure, humidity and rainfall. Sensors are placed in different locations. It consists of 3 main components namely, the sensors, a remote server and the monitors. The sensors send updates of the weather readings to the server every 5 mins. The server will store these values and update the monitors periodically every 1 hour with the latest readings at each station. Monitors will show all the latest weather readings at all locations. Additionally, to receiving periodic updates, monitors are able to query for the latest readings of all the stations or of one location at any time if required. Monitors can view the number of sensors and monitors connected to the server at any given time. The server will alert the monitors if the weather at any location reaches the critical values specified below. Temperature -