Remote debugging of tomcat using eclipse

If you are running tomcat on a remote machine and you want to debug the application running on the remote tomcat using eclipse on your local machine then this is the guide for you. Tomcat remote debug Configure tomcat The first step would be to add the following properties to the setenv.sh in the tomcat/bin/ … Read more

Commons dbcp creating connection issues, CLOSE_WAIT and java.lang.Thread.State: WAITING

Recently I was working on a application that was using dbcp  version 1.4 for connection pools and was running in tomcat 7. And after sometime of working with the application we found out that lots of connections related to the tomcat were ending up in CLOSE_WAIT.Here is a sample of the connections with tomcat pid as 1234: … Read more

SEVERE: The web application [/mywar] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@75af844e]) and a value of type [com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer] (value [com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer@5617593e]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

I have been debugging this issue using jvisiualvm and eclipse MAT. I had the below error when I was undeploying the war file. And after 10 deployments the tomcat was running out of memory After doing some research i found that this issue existed with the version 1.3 of saaj-impl https://java.net/jira/si/jira.issueviews:issue-html/SAAJ-46/SAAJ-46.html Since I use maven … Read more

An Executor with blocking submit()

Today we are going to talk about an executor that will be blocking on submit if n number of threads are already executing. Suppose if you have a threads running in parallel and they are resource intensive, you may want to limit the number of threads executing. This is what we will do in this … Read more

HelloWorld for PhantomReference

PhantomReference allows a programmer to know that an object has been garbage collected. And hence the programmer can do something else when an object is collected. Today I was working on a code that was using PhantomReference. And since I had never worked with it so I decided to write some tests and see how it … Read more

Migrating from tomcat 6 to tomcat 7

Recently I was working on an application and we were using tomcat 6 as the web container. We were changing from tomcat 6 to tomcat 7. I wanted to do it very easy, so just copied the server.xml from tomcat 6 and pasted it into the tomcat 7 config folder. I did so that I … Read more

Eclipse Tips

Here are eclipse tips and tricks that I find useful in everyday use of eclipse. Eclipse shortcuts: Shortcuts I use everyday Ctrl+1 seems to be the most useful shortcut of eclipse. It shows the quick help. e.g. create getter and setter on a property or rename a property. If you see an error or warning … Read more

Thread safe caching of JAX-WS clientproxies

According to http://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe? , clientproxies are not thread safe so I decided to create a Component which can pool the connections. I do it it by using Singleton design pattern. What is handled by this Singleton: This class creates the connections on the start and then caches them If the connection to the server is not available … Read more

GWT nocache.js cached by browser

Recently we faced an issue with the GWT deployment. Whenever we were doing a new deployment the users seemed to get errors as the gwt did not refresh the javascript files even when the user reloaded the page. Then the temporary solution was to reload all the files using Shift+F5.  All our pages had this … Read more