For those of us who have been running JUnit tests inside eclipse , one of the biggest feature available to us was the debug ability of the JUnit tests.
When we started working on Maven tests , the first questions which came to mind was , How am I going to debug it ?
I started with running the tests class by selecting the class in eclipse and right –> Run as Junit Test.
But this does not work. There are some variables which are being injected through pom.xml and tons of other dependency bugs which would be thrown.
So here is how to run your units tests in debug mode while running through mvn command. There are two steps to this. You will have to first set up a remote launcher, similar to the way you might have done for remote server.
Then you will run the tests from command prompt or
Create Remote Java Application Debug Configurations Read more…
As promised in last post Good bye MyEclipse. Welcome STS -Spring source Tool Suite, I would be going into the details of Spring TC server development edition and its integration with Spring Source tool suite (STS).
Spring launched the Spring source tc server which is a layer of functional ties and capabilities over the famous Apache Tomcat server. From Spring source site
SpringSource tc Server™ is an enterprise version of Apache Tomcat that provides developers with the lightweight server they want paired with the operational management, advanced diagnostics, and mission-critical support capabilities businesses need.
More details on Spring TC server can be found SpringSource tc Server — The Tomcat You Know
I decide to give the Spring TC server a shot. I downloaded tc Server Developer Edition(Free) edition (you will have to fill in details and then you get a link in email)
Read more…
Spring 3.0 has added annotation support for both task scheduling and asynchronous method execution. We will discuss @Async annotation and its uses.
The @Async annotation
The @Async annotation allows invocation of that method to occur asynchronously. In other words, the caller will return immediately upon invocation.
One of the use cases of @Async function can be in situations where in user registers and system has to send confirmation mail or any similar task where you do not want to block user.
We will look at the example below to explain it more clearly . Since for most of you this will be first Spring 3.0 application, please notice the changes in applicationContext.xml. Read more…
For those who live in New England or in and around Boston , here is a chance to learn about Spring 3.0 and its Spring Tc Server. There is a presentation on Thursday Jan 14 organized by NEJUG (New engalnd Java Group) at Sun Microsystem in Burlington.
The presentation would be done by Tom McCuch who is a Sr. Sales Engineer at SpringSource
Presentation Overview
Spring Framework is the core of the Spring group of projects, the popular and ubiquitous open-source platform used by more than half of the organizations building and deploying Java applications. Spring adds value at development and runtime by providing a platform which allows programs to be coded using a “Plain-Java” programming model, with much increased portability, testability, and agility (ability to evolve) compared to traditional approaches. Read more…
December 29th, 2009
Vinay
JDK 5.0 and above have come up with a convenient method to extract Array from a Collection without typecasting
<T> T[] toArray(T[] a)
The java doc says “Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.”
Usage :
Assume you want o extract the arrays of gurus .
Collection<String> guruCollection = new ArrayList<String>();
Read more…
Virtualization has been a buzzword for me, until recently I stumbled across it and gave it a serious thought. I thought about sharing my experiences in this blog.
To start with we had some issues on our linux hosted webserver and had to do some sanity checks by duping it, on somewhat a similar kernel. The usual system resource crunch and the nagging system admins put me on a no mans land.
Left with no options, I decided to do some checks using ubuntu kernel. Remember I still have my notebook (windows XP) to try stuff on, I could have easily partitioned and installed ubuntu with windows and done my job. But probably I was more inclined to virtualization and thought of trying it out. I did some groundwork and came up with options like Sun Microsystems Virtual Box, VMware, virtual pc etc to name a few. Read more…
Virtualization is a proven software technology that is rapidly transforming the IT landscape and fundamentally changing the way that people compute. Today’s powerful x86 computer hardware was designed to run a single operating system and a single application. This leaves most machines vastly underutilized. Virtualization lets you run multiple virtual machines on a single physical machine, sharing the resources of that single computer across multiple environments. Different virtual machines can run different operating systems and multiple applications on the same physical computer.
Here is an example how to Virtualize windows XP
In this post we will explore the features of Struts 2 action class and its capabilities.
Struts2 Actions are the most important and main part of struts2 Framework. They work as Model of MVC framework. Following article gives you more deep idea about Action classes role, configuration etc.
Action class Role:
1. Acts as Model encapsulates the business Logic: The main responsibility of Action class is to include business logic. The business logic will be encapsulated in execute method of the Action class. Read more…
Struts 2 Practical Tutorial:
Following tutorial demonstrates you a simple struts2 application and explains you how things work together in struts2. The tutorial demonstrates sruts2 using a calculator application which calculates different operation results and displays them.
The tutorial uses Eclipse3 IDE - or above.
Step 1: Download struts2
Download struts2-blank-xxx.war from : http://struts.apache.org/download.cgi
Step 2: create a project in eclipse
Create a new Web project in eclipse. (To create webProject click File Menu on top–> select New –> Select Web Project ).
Once you create the application will have src folder and a WebRoot folder. Read more…
Visual VM in JDK 1.6 is one of the best tools for monitoring the performance of your java/j2ee application. I am not sure why Sun has not marketed it well and kep it secret but this is a very good options for developers who always wanted to see how their applications behaves and if there are bottlenecks.
Imagine a developer did some change in application (added a new feature) and would like to know how his changes impact the application. Visual VM is very helpful in these situation. You can use it with standalone java application and can also integrate with your server.
Some of the helpful links on Visual VM are
Visual VM – All in one trouble shooting tool
JDK best kept secret – Visual VM
loitering objects make web company lose money
There are lot of tests to chose skill-guru. For those who are looking for java mock test , these test would be helpful to test their skills
java Interview questions
SCJP6 mock test
SCJP5 Mock test
Do you want to see some more mock test ? Give us your input