Leopard Hills in India

Jawai hills in Rajasthan called as leopard hills in India. This hill is in heart of the jawai dam which is built across Jawai River. Jawai hill comes under aravali hills range. We can find more number of leopards in this hill that’s why we are calling it as leopard hills in India.
There are many temples and memorials in the hills. Over many decades, the various communities of JAWAI have preserved their traditions and customs. We can find many temples have an idol of the leopards, also we can find villages near to the hills and those people are not disturbing the big cats. This makes the existence of people and leopards are living together.


Apart from leopards we can spot blue bulls, wild jungle cats, hyenas, wolves, jackals, hare, red fox, etc. along with a range of migratory birds in winter in this area. There are many resorts and hotels available here and they do offer safari and jeep ride in the forest. Wanted to see leopard close? Then this is the best place to find and discovering about the wild life. 


How to schedule a job in shellscript

In Linux based operating system we can schedule a job using cron tab but you should be a root user to configure this. We can achieve this through shell script as well, In this process we may to introduce some delay to achieve the frequency of the task.This script can be used in linux/unix/solaris operating systems. We can configure job at specific time as like below.

sh scripts.sh | at 0050 Mar 27 &

Here script.sh is the script we are scheduling at 12.50 am on 27 th March.  After started the script if you wanted to run the task every one hour . We can do as like below.

#run every 10 minutes
while true; do
// Add your task here
 sleep 10m

Now the task we defined will run in every 10 mins. Please note this job will go off if we reboot the machine.


Online traffic violation details in Bangalore

Bangalore city traffic police introduced the facility of checking the fine details of your vehicle through online. Earlier scenario is police man use to give the fine on spot, Also they will be in person to collect the fines. Now a days traffic police installed the camera in many signals in Bangalore city,even if the police man did not catch you we will be fined by monitoring the camera.  This fine will be keep on accumulating until we paid.We can pay this fine through online. Below is the url to check the traffic violation fine.

We never know when we violated the rules and caught by camera or police man who noted our number during violation. Its good to be checked and make sure that no fines in our vehicles.


How to get thread dump in java

Java thread dump is a handy information to figure out how the application is behaving on specific point of time.There are two ways to take the thread dump in a java based application.First we will see how to take a thread dump in Linux/Unix machine Linux/Unix We need to execute the blow command to get the thread dump and please make sure that JDK is installed in the machine.Here pid id the process id which we wanted to take the thread dump.

jstack -F pid > /tmp/ThreadDump.tdump

Windows. In windows its slight different than how we used to do in Linux/Unix but still we are going to use the java tools to get the thread dump. Go to java installation folder click on jvisualvm.exe under bin folder.

thread dump

This way we can get thread dump printed in the console we can copy and paste the information for further analysis.
thread dump 2


How to resolve async not supported issue on tomcat?

In tomcat based applications we might have encountered the issue like asyc is not supported. This is because by default its not supported in container level but we are trying to get the behavior that's when we used to get the below error.This kind of issue happens especially when you push the data from server to client.

Feb 05, 2016 2:18:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Push Servlet] in context with path [/bta] threw exception
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1673)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1030)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at org.springframework.security.web.context.HttpSessionSecurityContextRepository$Servlet3SaveToSessionRequestWrapper.startAsync(HttpSessionSecurityContextRepository.java:246)
at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
at org.springframework.security.web.servletapi.HttpServlet3RequestFactory$Servlet3SecurityContextHolderAwareRequestWrapper.startAsync(HttpServlet3RequestFactory.java:173)
at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:724)
at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:93)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:68)
at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.doService(Tomcat7Servlet30SupportWithWebSocket.java:67)
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:100)
at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:62)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2275)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:190)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:176)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

Possible Reasons:
1.Async support is not enabled in your container level
2.Aynce support is not enabled in framework level which your using.

Possible Solutions:
There are several ways to set the value of async supported is true.

1.In Web.xml we can define as like below


2. We define async support attribute through annotation as like below

@WebServlet(url="/test" asyncSupported=true)
class MainServlet extends HttpServlet{

3. In case of Atmosphere we can set as like below


4. In case of JSF

<servlet-name>Faces Servlet</servlet-name>

BESCOM power failure compliants

Bangalore Electricity supply company announced the power failure hot line number. This number can be reached in case of power failure due any reason  like natural disaster,rain,shot circuit,components burned etc.


We can call above numbers from our phone or send an SMS to following number.


How to set selected value in spring form select?

In general i have a list based on the list i need to populate the select box .There should be one default value which is not in the list, ie Select Country
<form:select path="country">
   <form:option value="NONE" label="Select Country"/>
   <form:options items="${countryList}" />
Now we have the value of country country code or id and based on the value selected values needs to be displayed.When we return the control to the particular page make sure that object bound to that page has proper values set for the variable defined in path attribute.
Lets take the example below
<form:select path="countryCode">
     <form:options items="${countryList}"  itemLabel=countryName itemValue=countryCode/>
We just need to populate the country code which needs to selected along with country list in object bound to that page,Rest everything is taken care by spring

How to inject spring application context

Spring application context can be injected into class and this can be achieved by interface provided in the spring. There is an interface called ApplicationContextAware ,by implementing this interface we can have spring context injected into the class.

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
class MyClass implements ApplicationContextAware
 private  ApplicationContext applicationContext;
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
spring context is injected when container loads, by using setter method available in this class.

Circular dependency injection in spring

Circular dependency injection is not possible in spring,lets see why its not possible. Lets say i have two classes class A and class B, In class A, class B is auto wired and in class B, class A is auto wired.

class A  
   B instanceOfB
 class B {
   A instanceOfA
When spring container starts, lets assume class A loading first in the container. When spring initialize the class A it finds dependency of B ,so the container try to create a instance of B and inject into A. Now when its try to create a instance of B,again it finds an dependency to A so the control goes to create a instance of A. Final outcome is recursive and we will not be able to achieve this. How to overcome this
There is no direct solution to achieve this but we have an work around for this issue.  Lets keep the class A as it is, but we need to make little bit changes in class B.We need to inject spring context in class B by implementing the interface ApplicationContextAware. So now class A instance is created without any issues. Now in class B we have method annotated with PostContruct and what this annotation does is initializeB method is get called after instance of B is created. In this method we are initializing class A,now both classes have the instance of other class. This way we can achieve the circular dependency in spring.

class A  
   B instanceOfB 
class B implements ApplicationContextAware{
 private ApplicationContext applicationContext;   
 public void setApplicationContext(ApplicationContext applicationContext) {
  this.applicationContext = applicationContext; 
 public void initialiseA()
   Class A = applicationContext.getBean("ClassA");

How to check web-socket connection is alive?

WebSocket is a protocol providing full-duplex communications channels over a single TCP connection. It is a next-generation bidirectional communication technology for web applications which operates over a single socket and is exposed via a JavaScript interface in HTML 5 compliant browsers.
Since it is completely depends on the TCP connection, Any network disturbance or network latency may lead to disturbance of the websockets but in this case onclose callback method of websocket will not be get called. This error leads to a data discrepancy. In this scenario readyState attribute of web socket also will not give you the correct value.
We can use below code to find out web socket is alive or not,what is does is it will try to send the some ping message to server.We will get error in case of websocket is not alive
var webSocket = new WebSocket(url, [protocal] );

webSocket('test message');
}catch(err) {
// your logic here in case of websocket dead

Java different version names

Each java version has its unique name. Please find the below list of versions and nick name
Java VersionRelease DateNick Name
JDK 1.1.4Sept 12, 1997Sparkler
JDK 1.1.5Dec 3, 1997Pumpkin
JDK 1.1.6April 24, 1998Abigail
JDK 1.1.7Sept 28, 1998Brutus
JDK 1.1.8April 8, 1999Chelsea
JDK 1.2Dec 4, 1998Playground
JDK 1.2.2July 8, 1999Cricket
JDK 1.3May 8, 2000Kestrel
JDK 1.3.1May 17, 2001Ladybird
JDK 1.4.0Feb 13, 2002Merlin
JDK 1.4.1Sept 16, 2002Hopper
JDK 1.4.2June 26, 2003Mantis
JDK 1.5Sept 29, 2004Tiger
JDK 1.6Dec 11, 2006Mustang
JDK 1.7July 28, 2011Dolphin
JDK 1.8Mar 18, 2014Lambda

How to Convert a .pfx/.p12 File to a Java Keystore (.jks) with the Java keytool

Java keytool alone is capable of converting .pfx file into .jks file. Please make sure that java is configured in your system.We need java version JDK 1.6 or later.
First step in this process we need to extract the alias name stored in the .pfx file.Run the below command in the command prompt to generate the aliasfile. This generated file contains the alias name.
keytool -v -list -storetype pkcs12 -keystore fileName.pfx > aliasfile.txt
Open the alias file and search the Alias name,So now we know the source alias name and destination alias name we can give anything.Generally we will give the company name
keytool -importkeystore -srckeystore fileName.pfx -srcstoretype pkcs12 -srcalias “[SOURCE ALIAS NAME]”
-destkeystore resultFile.jks -deststoretype jks -destalias “[DESTINATION ALIAS NAME]“

Logstash Read Object Values Printed in the Log

Logstash is a tool for reading logs and send it to the elastic search.Lets say we have object is printed in the log file and we can't write a grok pattern to entire log file. We need to extract certain information from that object. I have log file as below

171.741.544.442 - kurt [28/Jun/2015:01:48:10 -0700] "POST User[name:raja:age:25 Location[city:blr;state:ka;country:india]]]

 Above log i gave simple example of object but many case object would be very big and its not possible to write the grok pattern for entire log. So in order to avoid this scenario we need to  use macro called GREEDYDATA

 %{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{GREEDYDATA}state:%{WORD:state} 

 I have wrote the grok till http method type post "171.741.544.442 - kurt [28/Jun/2015:01:48:10 -0700] "POST" rest of the part going to greedydata. Which means entire object goes to greedy data. Once greedy data is generated we are applying filter on top of it to get the state.Above example solve the problem of reading the logs in between in logstash  and reading objects printed in the log file using logstash.

How to configure head plugin for elasticsearch

We use elastic search for log analysis and analytical reports. Head is the one of the plugin in elastic search and this plugin make search easy in elastic search world. Default elastic search package will not have this plugin and we need install in explicitly.

Lets see how can we install this plugin.
 1. Navigate to the bin folder of the elastic search
2. execute  this command "plugin --install mobz/elasticsearch-head"


How to configure sense for elasticsearch

We use elastic search for log analysis and analytical reports. Sense is the best tool to search the data in elastic search and it comes up with marvel.Marvel is the one of the plugin in elastic search and this plugin make search easy in elastic search world. Default elastic search package will not have this plugin and we need install in explicitly. Lets see how can we install this plugin.
 1. Navigate to the bin folder of the elastic search
2. execute  this command "plugin -i elasticsearch/marvel/latest"


After installing marvel plugin navigate to the url http://localhost:9200/_plugin/marvel. This will redirect to the marvel UI,Go to the dashboard then click on sense. This will navigate to http://localhost:9200/_plugin/marvel/sense/index.html.


How to remove elastic search plugin

We cannot keep unnecessary plugin installed in the server and it consumes the resource. Removing plugin from elastic search is very simple. Let see how can we do that

 1. Navigate to the bin folder of the elastic search
2. execute  this command "plugin --remove 'pluginin_name'"


In the above example kopf is the plugin name. This way we can remove the plugin from elastic search.

Google Public DNS Server IP

DNS servers are used to resolve the IP addresses. Google has provided two DNS servers for public use and this IP address can be used in following situations.

 1. Check the internet connectivity from your machine by pinging the IP
2. In-case your local DNS server is not working we can point it out to google server to make it work. Below are the google public DNS servers

How to Connect FTP Server in Windows?

Wanted to upload some files in FTP server? No need to worry about installing third party application to do this. Windows  provided this facility by default to us. Lets see how can we do this. Open any folder or windows explorer and type the FTP URL in the address bar as like below


In above example we used some sample FTP url. While uploading make sure that internet connection is proper because this lead to uploading data in inconsistent state.  As soon as hit the FTP url , we will get an prompt for authentication. We need to enter proper user name and password to access the FTP server.

Once we successfully authenticated we will be able to see the content of the servers in folder structure. Now we can just copy and paste the content from local machine to FTP server.  

Cross site framing vulnerability in java

What is Cross Site Framing:
Cross site framing means application page of one website is completely rendered with in iframe of another website. This creates a feel  like we are in the site where the actual page is but actually we are working in third party website now. Still not clear? let see the example below.

Let us say for example site www.onlyjavaexceptions.com has framing vulnerability. So the hacker created iframe and included some of the main urls in onlyjavaexceptions site as like above. Using CSS tricks they create a iframes such a way that u feel like your in original site only.

What is the Benefit:
As soon as we landed in hackers site they have full control of the parent page. Since original site is included as iframe parent window control is with hacker. So the hackers can get your critical and confidential information's by observing the keystrokes with in child iframe. Due to this Cross Site Framing are one of the biggest threads for the website .Now lets how to avoid this in java.We need to add some response headers in the response and this response header needs to be added all the pages where ever sensitive information is shared. If you feel entire site needs to protected then add in the filter because filter is the entry point for any request. We need to add header called X-FRAME-OPTIONS in the response.Since we wanted to protect entire site lets add it in the Filter

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CommonFilter implements Filter {
 private FilterConfig config;

 public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException,
   ServletException {
      ((HttpServletResponse) resp).setHeader("X-FRAME-OPTIONS", "DENY");
   chain.doFilter(req, resp);


 public void init(FilterConfig config) throws ServletException {
  this.config = config;

 public void destroy() {
  config = null;


In X-Frame-Options if we give "DENY" then any iframes will not work even if the iframe from same domain. If you want same domain iframe needs to work we may use SAMEORIGIN option. Also following entry needs to be added in the web.xml


After above settings if we access the content of the site in frame only blank page will be displayed. Same task can be achieved in client site by using frame bursting java script code.This java script makes sure that frame content will not be loaded properly

How to get the process name by using PID in linux/unix

In Linux some times we have process id and wanted to check the name of the process. We can execute the following command to check the name of the process.

ps -p 1337 -o comm=

ps - List all the process running in the machine

How to install elapsed filter in logstash?

Logstash has multiple filters and plugins but it is not available by default.Some plugins and filters needs to be installed manually by us before we use it. One of the filter is called elapsed filter.The main purpose of this filter is to find out the time difference between two points. Lets say we start process with time t1 and process ending with time t2 and this is process uniquely identified using id. Now using elapsed filter we can find time took to finish the process. Now lets see how can we install this filter in logstash. Go to bin folder of logstash and execute following command.

plugin install logstash-filter-elapsed

After executing above command we see following lines in the console for the successful completion.

Validating logstash-filter-elapsed
Installing logstash-filter-elapsed
Installation successful

How to resolve absent code attribute in method error?

If the application is built on JSF some times we might an faced an error like "Absent code attribute in method". This kind of issue we might have faced when we set up the applications.

 Possible reasons: 
 1. Main reason for this error is, we don't have required libraries in class path.
 2. There might be a conflict between two versions of the same jar.
 3. There is a possibility same class name exists in different jar files.

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
 at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
 at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
 at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1137)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)

Database exception ORA-01089

In oracle database every error associated with an error code. In some times we might have encounter the situation database operation takes long time to respond and it will get timed out. When we checking the logs we will get following exceptions.

  Possible Reasons:
 1. Database instance might be killed
 2. Database service is not responding due to memory issue

java.sql.SQLException: ORA-01089: immediate shutdown in progress - no operations are permitted

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:141) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:468) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1254) ~[ojdbc14.jar:Oracle JDBC Driver version - ""]
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:549) [c3p0.jar:]
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234) [c3p0.jar:]
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) [c3p0.jar:]
        at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964) [c3p0.jar:]
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0.jar:]
[distributor] 2015-09-09 12:27:38,438 CEST +0200 WARN  [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] [BasicResourcePool] Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@4f9b94fa
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@4f9b94fa
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:571) ~[c3p0.jar:]
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234) ~[c3p0.jar:]
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) ~[c3p0.jar:]

How to check JVM version is 32 bit or 64 bit?

In java there are different versions of binary files available for 32 bit and 64 bit. After java installed some times we may need to check installed version is 32 bit or 64 bit because some applications are not compatible with 32 bit version of java. We can use the same command we use for checking the java version.

  Option 1:

java -version

Resulting output of the 32 versions and 64 bit versions are almost same except one small change.In 64 bit installation we can find the text 64 bit server VM as like below.
But in 32 bit machine we will get the message like Client VM as like below.
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b02)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)

Option 2: 
Go to control panel and we can find java icon. If 32 bit version of java installed we can find 32 bit mentioned in the bracket in java icon.

Command to list all the certificates in javakeystore(.jks)

We can import multiple types of certificates into java key store format(.jks). After we successfully created we need to verify list of certificates available in key store. We can use following command to list all the certificates in .jks file.

keytool -v -list -keystore myfile.jks

How to convert pem file to jks?

We might be having .pem file but application accepts only .jks file then we need to convert them into jks format. Let see how to achieve this. Generally .pem file has both private key and certificate but in some case both are in separate files.In that scenario we need merge them in single file.

cat serverkey.pem servercert.pem | openssl pkcs12 -export -out combinedcert.p12

Now lets import the certificate into keystore using java keytool

keytool -importkeystore -srckeystore combinedcert.p12 -srcstoretype pkcs12 -destkeystore myfile.jks

That's all , we are done.

JAX-WS hello world examble using annotations in java

XML Web Services (JAX-WS) API is readily available in java to create web-service easily.This web-service is completely based on the annotations.We may need to work with java versions more than 5 because of the annotation dependency. Lets see the hello world web-service application. First we need to create an end point interface and this interface contains what are methods we are going to expose as a service.

package com;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@SOAPBinding(style = Style.RPC)
public interface HelloWorld {

 String getMessage(String name);


There are three important annotations used here i. @Webservice: It marks this Java class as one implementing a Web service. ii. @WebMethod: This annotation signifies this particular method is going to expose as a webservice operation. This method should be public and this must return a value iii. @SoapBinding: This annotation signifies the mapping of the Web Service onto the SOAP message protocol. Now end point interface is ready and lets create the end point implementation.

package com;

import javax.jws.WebService;

//Service Implementation
@WebService(endpointInterface = "com.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

 public String getMessage(String name) {
  return "Success "+name;


In the web service annotation we need to specify the package location of the Endpoint interface. Now we are done with the webservice implementation, in order to access the webservice we need to publish it as like below.

package com;

import javax.xml.ws.Endpoint;

//Endpoint publisher
public class Publisher {

 public static void main(String[] args) {
  Endpoint.publish("http://localhost:8500/ws/hello", new HelloWorldImpl());


Webservice is ready to use now,JRE internally creating wsdl files for our implementation this can be verified by accessing the URL http://localhost:8500/ws/hello?wsdl

How to install Eclipse plugins from Eclipse Marketplace?

Eclipse market place client is a tool  used to install the software components.Eclipse plugin's and extensions can be easily downloaded and install it in eclipse.Main advantage of using market place is that we don't have provide the url to download the plugins. In order to install from marketplace, select Help → Eclipse Marketplace.


Type the plugin in name which you wanted to install then click go button. In above example i searched SVN plugins and this search will list all the plugins available. Now we can select and install the particular plugin.After installing the plugin we may need to restart the eclipse. Most of the case eclipse market place client will be available in Help tab but some older version we may not find eclipse market place option, in such scenario we can install clients as like below.


How to Resolve Eclipse Start up is Very Slow?

In eclipse work space we might be running multiple projects , eclipse monitor all the changes in source code and store these state information's in file. This file is called as .snap file or .marker files depending on versions.  These files are used to recover your work-space state when ever eclipse is crashed.


All the project will have one .snap files or .marker files. This files can be found in following location
We can delete these files and after deleting the files we can see eclipse start up would be fast. 

How to Configure NxLog to send logs to Logstash in Windows?

Nxlog is multi platform log collector and forwarder,In windows we can use logstash forwarder or nxlog to collect and send the logs to logstash server. In this article we will see how to send the logs using nxlog. Download the nxlog from http://nxlog.co/products/nxlog-community-edition/download and install it in your machine. After installation go to nxlog installation folder under conf we can find a file called nxlog.conf. All the configuration of nxlog will be provided in this file.
We could see following default configurations in nexlog like loglocation,module location etc...   In our example we are going to read one file and send those information to logstash. we need to do following configuration in configuration file.

<Input in>
    Module im_file
     File "C:\\Application.log"
    SavePos TRUE

<Output out>
    Module      om_tcp
    Port        3515

<Route 1>
    Path in => out

First in the input section we need to include file module to read the files and also need to specify the location of the file in input section.Next output section we need to specify how are we going to send the files,here we mentioned over TCP we are going to transmit the message on particular port. This is the port where logstash is going to read the logs.Route tells how are we going to process the data. We are done with configuration. We can start nxlog either from running nxlog.exe or from the system services. Now lets look at the logstash configuration

input {
  tcp {
    port => 3515
    type => "nxlogs"

filter {
match => ["message", "\[%{WORD:component}\] %{TIMESTAMP_ISO8601:timestamp} %{WORD:timeZone} %{NUMBER:responseCode}%{SPACE}ERROR%{SPACE}\[%{NOTSPACE:comp}\]%{SPACE}\[%{NOTSPACE:process}\]%{GREEDYDATA:errorMsg}"]


output {
  stdout { codec => rubydebug }


Now we configured logstash receive the inputs from tcp port 3515 and pattern will be matched against the incoming messages and produce required output. Now start the logstash first we should not see any errors in startup then we need to start the nexlog. We can verify the status of the connection between nxlog and logstash through log file. This log file available in \nxlog\data\nxlog.log and we should see the message like below if its started properly.

2015-08-14 12:21:09 INFO connecting to
2015-08-14 12:21:09 INFO nxlog-ce-2.8.1248 started
That's all.

How to disable class code verification in eclipse using JVM argument?

Class verification is done when ever we execute the class file in java.Verification of class file is needed because it could be build in another system and we receive through internet. In internet any one can intercept your byte code and inject some malicious code in it.This will be impact to the system hence class file is verified before using it.  Verification of class process is happening when class loaded into JRE usually it takes some time. Classes would be loaded in lazy manner hence during the application start up might be little delayed or some unexpected errors. But if your running  your application local machine we don't have to verify byte code and this is not accepted in production system.  If class verification fails we will get below error.

    Expected stackmap frame at this location.
    0000000: 2b3a 042c 3a05 b201 432a 2a19 0419 05b8
    0000010: 0128 4eb8 00e8 2db6 00ec 2ab4 0004 2b2c
    0000020: b600 1c59 3a06 593a 07b8 00e8 2d19 07b6
    0000030: 00f6 1906 b03a 08b8 00e8 2d19 08b6 00fa
    0000040: 1908 bf                                
  Exception Handler Table:
    bci [19, 53] => handler: 53

Class file validation can be avoid by passing following JVM arguments in eclipse. Go to Project - > Build Path - > Configure Build Path. Click JRE or JDK -> Installed JRE. Dobule Click on JRE. In Default VM arguments pass '-noverify' click ok now.


How to write console logs into file in eclipse?

When ever we run the servers in eclipse ,we may not be able to see all the log entries due to logging it very fast. Either we need to increase the buffer size in eclipse or stop the process then check the logs. Instead of above approach we can redirect console out  to file then we can verify. Lets see how can we write the console to file. Go to Server "Run Configurations" then click common tab.

Select the file option and locate where the file needs to be generated. Now when ever we start the server all the console events to be written in this file.

How to Export Spring Beans into JMX Console?

In spring container we might have defined many objects , how can we expose those beans in JMX console. JMX console is the utility provided by java so that we can monitor and access run time parameters. Lets create sample spring class that is going to registered as MBean.

package com;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;
import org.springframework.jmx.export.annotation.ManagedOperationParameters;
import org.springframework.jmx.export.annotation.ManagedResource;

public class SpringJMXExample {

public String getMessage() {
  return "Hello";

@ManagedResource annotation tells the container this class going to act as Mbean. Now we have Mbean class which returns as message Hello, we need to register this class in MBean server. In order to register this class we need to create following entries in spring context xml.

<bean id="mbeanExporter"
     class="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />

Above class register all the MBean class into Mbean server. In order to access your MBean through JConsole we have to pass some JVM arguments when we run our program. In web based application we can set JRE arguments as like below.

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8855 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

Now we are ready with configuration start your server. Go to command prompt type jconsole.If your java home is set properly we can see following jconsole window.


 Select local process if your server is running in locally or select remote proceess. Now type the following url No need to give user name and password click connect. As soon as connected we can see the class name is getting displayed. Now when we expand the class name it will give attributes and operations as options. Here operations means methods we defined in Mbean class,now if you click getMessage method it will return and says Hello.


Convert Easily Your Sourcecode from Log4j to Logback Using Migration Tool

Most of applications earlier we use log4j for application logging and monitoring. Now with a latest trend we intended to switch to logback framework because of its fast and features. How can we migrate our source code from log4j to logback. There is an utility build by logback team to easy migration. We can download the utility from Here After download the package we could find multiple executable jars in that package.We need to click slf4j-migrator jar file then we see below screen opened up.


Select the option from log4j to slf4j,Now we need to point out the directory where our source code is located, if we have multiple projects select the root directory of the project. Now click Migrate project to slf4j,this will covert all the source code to slf4j and finally gives the count list of files modified. This tool has some limitations as well, what it does is simple  source code modification and this will not modify the configuration files such as xml files and build files.

How to Resolve LifecycleProcessor not Initialized Error in Spring?

Spring based application we might have faced this issue, We could see server is started but application will not come up but in the logs we see following exceptions.

java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri Aug 07 17:01:02 IST 2015]; root of context hierarchy
 at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
 at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1059)
 at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
 at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
 at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
 at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4927)
 at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5573)
 at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

Possible Reasons:
 1.This error signifies spring context is not yet started.
2. This is generic error we get when ever spring context is not started and check the server logs to see more information about the failures.
3. Please make sure that your tomcat work directory is cleaned because some times in proper publishing of resources may leading to this error.