A Developer's Diary

Jan 20, 2013

Consuming a webservice using Apache Axis2

The post assumes one to be familiar with the steps to create and host a web service using Apache Axis2. If not, you can refer the following tutorial.

Configuring Apache Axis2
1. Download the Apache Axis2 Binary packages from here
2. Extract the binary package and set the variable AXIS2_HOME to point to the extracted location
3. Append %AXIS2_HOME%\bin to your path

Read more ...

Jan 13, 2013

Axis2 Web Service - A Simple tutorial using Maven

Creating a Web Service using Axis2
A plain java class can be declared as a web service provided
1. It has a public method and the class has been defined in the services.xml file
2. The services.xml file should be placed under META-INF directory of the archive file

Read more ...

Jan 12, 2013

Maven - Copying artifacts to specific folder

Above is the directory structure of web application generated using maven. Use maven-dependency-plugin for copying artifacts to desired folder under WEB-INF directory

Read more ...

Jan 10, 2013

Dealing with cache issues in Jnlp applications

Even though I had disabled the temporary internet files setting in the java control panel as shown below, my jnlp application will still not pick up the latest changes. This is a common issue faced by java web start application developers and becomes quite annoying if changes are not getting reflected. javaws -uninstall is an useful command related to java web start which clears up the cache for you and you need not struggle with deleting the jar files in the %temp% or other folders.

Command for deleting Java Web Start Cache
javaws -uninstall

Read more ...

Debugging Java Web Start / JNLP Applications

Steps for debugging a java web start jnlp application

Step 1. Open a command prompt window (Windows)
Step 2. set JAVAWS_TRACE_NATIVE=1
Step 3. set JAVAWS_VM_ARGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
Step 4. Run javaws http://server:port/appname/application.jnlp
Step 5. Goto eclipse debug configuration screen and create a new Remote Java Application debug configuration
Step 6. Under the connection properties, specify the hostname of the machine where you have started the terminal and port as 8000, apply and click debug


Read more ...

Jan 3, 2013

Deploying web applications using maven command line

Maven comes up with a powerful list of features and plugins for rapid application development, deployment and testing.

While developing web applications, the need is always felt to deploy, undeploy and redeploy applications using the command line. For apache tomcat, maven comes up with a tomcat-maven-plugin which facilitates the same.

1. Follow the steps mentioned in the post for creating a simple web application.
2. Add the below lines in your pom.xml. This will download the tomcat-maven-plugin jar in your local maven repository.

<build>
    <finalName>webapp</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <configuration>
                    <url>http://localhost:8080/manager/text</url>
                    <username>admin</username>
                    <password>admin</password>
                </configuration>
            </plugin>
    
        </plugins>
    </pluginManagement>
  </build>

Read more ...

Jan 1, 2013

Stack implementation using a singly linked list

The below is a stack implementation using a singly linked list.
1. push adds node on top of the stack
2. pop removes the top most node from the stack
3. top returns the top most node of the stack without modifying it
4. isEmpty checks if the stack does not have any elements

The details of the StackNode class

package com.ds.programs;

class StackNode<E>
{
    E data;
    StackNode<E> next;
}

Read more ...