Skip to main content


Weblogic - JavaEE 6 migration to JavaEE 7

Weblogic migration to 12.2.x  There are significant changes done between JEE 6 and JEE 7. Weblogic 12.2.x uses JEE 7 and applications need to migrate the weblogic related configurations along with JEE API version. In JEE7 many ejb and weblogic related schemas has been changed which I have listed down here. Required schema declaration for all related configurations are as given below. weblogic-ejb-jar.xml <weblogic-ejb-jar xmlns="" xmlns:xsi="" xsi:schemaLocation=""> ejb-jar.xml <ejb-jar xmlns="" xmlns:xsi="" xsi:schemaLocation="
Recent posts

Adding/ Editing Health checks to deployments in OpenShift

What are health checks in OpenShift Health checks are required to ensure that application is resilient so application can be restarted without manual action. Such health checks can be configured using probes in openshift. Kubernetes provides two type of probes, readiness probe and liveness probe. Liveness probe Liveness probe checks that application is running and handles those situations when there is any issue with application. Readiness probe Readiness probe check whether application is ready to handle the traffic. Another benefit of having these health checks is that you can restart or deploy application with zero downtime when you are having minimum 2 pods running for your application. In this case it will not bring all the pods down. Supported health check types You can configure the health check of below type for both of the above probes. HTTP Health Check It will call a web URL and if it returns the HTTP status code between 200 and 399 then it will consider as

Allowing Cross domain POST request with JSON or XML content type in Java

Cross domain POST Request Cross domain POST requests supports only below content types and other content type are not allowed by default. application/x-www-form-urlencoded multipart/form-data text/plain So, if we try to make an ajax request to such POST URLs with XML or JSON content type, it will not be able to make request and give CORS error. Allowing Cross domain POST request with JSON or XML Content-Type We have our service implemented in Java and we will use Servlet Filter & request wrapper to build our solution. Please see my below POST to see how to implement CORS using java servlets which works well with GET methods or allowed content types with POST method. In this POST I will explain only additional things required for our problem with POST request, so I request you to go through the above link first. Request wrapper to change/ override the content-type to JSON or XML

Microservices with Spring Boot - complete tutorial

In this tutorial we are going to learn how to develop microservices using spring boot with examples. Main focus of this tutorial is on learning by doing hands-on. Before hands-on we will first understand what is microservices and related terminologies like DDD, 12-Factors App, Dev Ops. What is a Microservice In simple terms microservice is a piece of software which has a single responsibility and can be developed, tested & deployed independently. In microservices we focus on developing independent and single fully functioning modules. Opposite to microservice, with monolithic application it focuses on all the functionality or modules in a single application. So when any changes required to monolithic application it has to deploy and test the complete application while with microservice it has to develop and deploy only affected component which is a small service. It saves lot of development and deployment time in a large application. It's basically an architectural style

Microservices - Spring cloud API gateway along with registry server

Here we will learn, how to create API gateway using Spring cloud API. We will also register it with discovery/ registry server. Also will see how to access microservice using registry server through API gateway. What is API gateway As its name implies, API gateway is the single entry-point to an application or system. It can handle a request and invoke the appropriate service registered with it. It provides many features like protocol translation, filtering, security, interceptors etc. Using API gateway we can invoke any microservice whether its direct invocation or using some registry/ discovery server to invoke registered services using their ID. Creating API gateway In our example we will create an API gateway which will register itself with Eureka discovery server and will invoke the microservice available in discovery server using its registered service ID. API gateway can be implemented two ways, one is using Zuul proxy and second is using spring cloud API gateway. Differ

Microservices - Service Registration/ discovery using Spring boot and Eureka

In this tutorial we will learn how to create registry/ discovery server using Eureka and Spring boot. We will register our Rest microservice with this registry server which can be discovered by client by connecting to registry server. What is registry/ discovery server We can assume registry or discovery server as a central place where we can find all our microservices using their registered IDs with discovery server. Microservices register themselves in registry server and client applications access them using a single registry or discovery server. It is similar to a phone directory but provides many other useful features. If we don't user registry server then we need host name and endpoint details to access a service. In today's era most of the services are deployed in cloud and using cloud features like auto-scaling where network addresses are updated dynamically and we can't use a simple network address for that. Now when we use registry server, then such microserv

Mock unit testing with Mockito and Spring (Ejb and Rest service)

In this tutorial we are going to learn about mock unit testing. We are using here Mockito with Spring to write unit tests. We will also see how to mock an EJB session bean inside mocked service without constructor/setters injection. What is mocking Mocking is a technique to replace the actual implementation with some dummy or provided code chunk during unit testing. For example if we need to unit test some service which persist data to database then we can mock that persist method to add it to some in-memory collection. Also we can mock data retrieval to get the data from same collection or so. Mockito provide various class and features to implement the mocking seamlessly. Maven dependency We are using Spring (XML base configuration) and mockito for mock testing. Below dependencies are required. <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.9.RELEASE</ver