Wednesday, May 14, 2014

Java JSON JQuery

This post is a small example web application using Java, JSON, JQuery.

JSON (JavaScript Object Notation) is now conquering the attention in the Web Applications, Mobile Applications, Big Data etc., If you don't know about JSON, properly it is about time to learn.

Example JSON:  {"name":"Book Name","author":"Book Author","publisher":"Book Publisher"}

We will be using the above JSON data in our example, it is basically key value pair. Both key value are enclosed in double quotes ".  "Key" : "Value"  separated by colon :

Subsequent key values are separated by comma , and complete data is enclosed in braces { }

Prerequisite Knowledge / Skills 
-- Java 
-- Eclipse IDE
-- Basic Javascript
-- Basic JQuery knowledge 

Development Tools Required
-- Eclipse IDE Juno / Kepler 
-- Tomcat 6.0 +

Design Concept 
BookServlet  --> Get Method will retrieve the List (ArrayList) of books  in JSON Format
BookServelt --> Post Method will add Book to the List(ArrayList)
index.jsp --> will place 2 types of request, one using get and another using post. Both request are sent to BookServlet but for different methods. 

Project Structure in Eclipse with Files 
JavaJQueryJson
--.settings
--build
--src
----com
------demo
--------json
----------Book.java (src / com / demo / json )
----------BookList.java (src / com / demo / json )
----------BookServlet.java (src / com / demo / json )
----------Status.java (src / com / demo / json )
--WebContent 
------index.jsp (WebContent )
------js
------------jquery-1.11.1.js (WebContent / js )
------META-INF
------WEB-INF
------------web.xml (WebContent / WEB-INF )
------------classes
------------lib
----------------gson-2.2.4.jar (WebContent / WEB-INF / lib )


Step 1: In your eclipse IDE create a dynamic web project


Step 2: Project name  JavaJQueryJson 

Step 3: We will  be using GSON framework Java Library

Open the URL --> Navigate to Downloads 
Step 4: Copy the jar file to the Web Project/WEB-INF/lib folder

Step 5: Create a new class


Step 6: Package name --> com.demo.json  & Name: Book


Step 7: Book.java is a POJO class with 3 attributes and getter & setter


package com.demo.json;

public class Book {
private String name;
private String author;
private String publisher;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}

}

Step 8: Create BookList Class



Step 9: BookList.java is a Singleton class to add list of Books and get list of Books



package com.demo.json;

import java.util.ArrayList;
import java.util.List;

public class BookList extends Status{
private static BookList bookListInstance = null;
private List<Book> bookList = new ArrayList<Book>();
private BookList()
{
}
public void addBook(Book book)
{
bookList.add(book);
}
public List<Book> getBooks()
{
return bookList;
}
public static BookList getInstance()
{
if(bookListInstance==null)
{
return new BookList();
}
else
{
return bookListInstance;
}
}

}

Step 10: Create new java class Status



Step 11: Status.java is a simple POJO class with getter and setter



package com.demo.json;

public class Status {
private boolean status;
private String description;
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}

}

Step12: Download JQuery from http://jquery.com/

And copy the js to the folder WebContent/js



Step 13:  Create a new Java Servlet 



Step 14: Name the Servlet as BookServlet


Step 15: doGet method implementation


Step 16: doPost method implementation




Source Code:

package com.demo.json;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

/**
 * Servlet implementation class BookServlet
 */
public class BookServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

private static BookList bkList = BookList.getInstance();

/**
* @see HttpServlet#HttpServlet()
*/
public BookServlet() {
super();
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
*      response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {

response.setContentType("application/json");

Gson gson = new Gson();

try {

System.out.println("BK List: " + gson.toJson(bkList.getBooks()));

response.getOutputStream().print(gson.toJson(bkList.getBooks()));
response.getOutputStream().flush();

System.out.println("doGet Success");

} catch (Exception ex) {
ex.printStackTrace();
Status status = new Status();
status.setStatus(false);
status.setDescription(ex.getMessage());
response.getOutputStream().print(gson.toJson(status));
response.getOutputStream().flush();
}
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
*      response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub

response.setContentType("application/json");

Gson gson = new Gson();

try {
StringBuilder sb = new StringBuilder();
String s;
while ((s = request.getReader().readLine()) != null) {
sb.append(s);
}

System.out.println("JSON Data: " + sb.toString());

Book book = (Book) gson.fromJson(sb.toString(), Book.class);

Status status = new Status();
if (book.getName() != null && !book.getName().trim().equals("")) {
status.setStatus(true);
status.setDescription("success");

bkList.addBook(book);
} else {
status.setStatus(false);
status.setDescription("Book name is null or empty");
}
response.getOutputStream().print(gson.toJson(status));
response.getOutputStream().flush();

System.out.println("doPost Success");

} catch (Exception ex) {
ex.printStackTrace();
Status status = new Status();
status.setStatus(false);
status.setDescription(ex.getMessage());
response.getOutputStream().print(gson.toJson(status));
response.getOutputStream().flush();
}
}

}


Step 17: index.jsp in the WebContent Folder


<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Java JQuery JSON </title>
<script src="./js/jquery-1.11.1.js"> </script>
<script>
$(document).ready(function(){
  $("button").click(function(){
   $.getJSON('http://localhost:8080/JavaJQueryJson/BookServlet', '' , function(result){
     $.each(result, function(i, field){
        $.each(field, function(key, value){ 
        $("#results").append(key +": "+ value + " &nbsp;&nbsp;&nbsp;&nbsp;");
        });
        $("#results").append(" <br/> ");      
     });
   });
  });
});
function isEmpty(val){
    return (val === undefined || val == null || val.length <= 0) ? true : false;
}
function addBooks()
{
if(isEmpty($('#bookname').val()))
{
alert("Book name cannot be null");
}else
{
var dataJson = '{"name" : "'+ $('#bookname').val()+'","author" : "'+ $('#bookname').val()+'","publisher": "'+ $('#bookname').val()+'"}';
   $.ajax({
       type: 'POST',
       url: 'http://localhost:8080/JavaJQueryJson/BookServlet',
       data: dataJson, // or JSON.stringify ({name: 'bookname'}),
       success: function(result) {  
       $.each(result, function(i, field){
           $("#status").append(i +": "+ field + " <br/> ");
       });
       },
       contentType: "application/json",
       dataType: 'json'
   });
}  
}
</script>
</head>
<body>
<input type="text" name="bookname" id="bookname" /> 
<input type="button" name="btnAdd" id="btnAdd" value="Add Books" onclick="addBooks()" />
<br></br>
<div id="status"></div>
<br></br>
<button>Get Books</button>
<div id="results"></div>
</body>
</html>

Step 18: Final Result


Tuesday, April 29, 2014

Axis2 Installation in Websphere 8.0 to 8.0.0.8

The following tutorial is about Axis2 Installation in Websphere 8.0 to 8.0.0.8

Step 1: Download the Required Axis2 War file from the Apache Axis Website
http://axis.apache.org/axis2/java/core/
Click on the Releases


Step 2:  Download the Version you need to install

You can choose Axis2 1.6.1 or 1.6.2


Step 3: Extract the war file from the Zip file




Step 4: For convenience  i have renamed the war file with specific version names

axis2.war to axis2_1_6_1.war / axis2_1_6_2.war depends on the version of war file which you have downloaded

Then Open the Zip file in the WinZip / 7Zip / Any Other utility



Step 5: Update the axis2.xml with the following attribute from false to true



Step 6:  Update the file in the axis2_1_6_2\WEB-INF \conf  folder


Step 7: Navigate to Websphere 8.0 Admin Console 

Application --> Application Types --> Websphere enterprise applications --> Install 



Step 8:  Click choose in the install page



Step 9: Browse and Select the updated war file axis2_1_6_2.war (**Updated Axis2.xml must be in the war file)


Step 10:  Click Next after selecting the war file 



Step 11: Select Fast Path and Click Next

Step 12: Click Next with default parameters



Step 13: Click Next in Map Modules to Server


Step 14: Click Next in Map Virtual Host



Step 15: Provide the Context Root as /axis2 and Click Next


Step 16: Click Finish in the Summary Screen


Step 17:  Click save directly to master configuration




Step 18:  Click on the deployed war file

Step 19: Click on Class Loading and update detection


Step 20: Select Classes loaded with local class loader first (parent last) and click apply
 Step 21: Click Save directly to the master configuration


Step 22: Click on the deployed war file


Step 23: Click on Manage Modules



Step 24:  Click on the Module Name Hyperlink Apache-Axis2


Step 25: From the drop down Class Loader Order --> Select Classes loaded with local class loader first (parent first) and click apply

Step 26:  Save directly to master configuration


Step 27: Click Ok


Step 28: Save directly to master configuration

Step 29: Select the war file and Click Start


Step 30: Application started successfully message will be displayed


Step 31: Open the url http://localhost:9080/axis2/services/Version?getVersion



Apache Axis 1.6.1 --> Run's fine in Websphere 8.0 at different patch levels

Apache Axis 1.6.2 --> Needs special changes in Websphere 8.0 at different patch levels especially for UNIX or LINUX operating system. In windows it will work fine for the above instruction.

I would strongly recommend to go for the latest version as of now 1.6.2


If you using Apache Axis2 1.6.2 in UNIX or LINUX you need to follow the below steps too

Step 32(Only for LINUX & UNIX OS): Copy (Not Move) the mar file to a jar file and move it to single jar file aall_module_secure.jar
The final jar file should be placed to the WEB-INF\lib
Rationale: IBM Websphere 8.0.0.1 doesn’t class load automatically for modules 
Step 33 (Only for LINUX & UNIX OS): Don't use the default axis2.xml from Apache Axis2 1.6.2 you need to get the axis2.xml from the IBM Websphere server local /apps/WebSphere8/AppServer/plugins/org.apache.axis2.jar 

org.apache.axis2.jar contains the axis2.xml file and other modules

Troubleshooting: 

In case of any problem first thing to check is go the url http://localhost:9080/axis2/  and click validate


Make sure the jar files are loaded from WEB-INF/lib from the screen shot




If you have something like below then you have missed the Step 24, 25 and 26.

You can see that the axis jar file is loaded from Websphere instead of WEB-INF lib which is wrong
\WebSphere\AppServer\plugins\org.apache.axis2.jar 



Examining webapp configuration

Essential Components

Found Apache-Axis (org.apache.axis2.transport.http.AxisServlet)
  at C:\IBM\WebSphere\AppServer\plugins\org.apache.axis2.jar
Found Jakarta-Commons Logging (org.apache.commons.logging.Log)
  at C:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.prereq.commons-logging.jar
Found Streaming API for XML (javax.xml.stream.XMLStreamReader)
  at an unknown location
Found Streaming API for XML implementation (org.codehaus.stax2.XMLStreamWriter2)
  at C:\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\AARYAN-VAIONode01Cell\axis2_1_6_2_war.ear\axis2_1_6_2.war\WEB-INF\lib\wstx-asl-3.2.9.jar
The core axis2 libraries are present.
Note: Even if everything this page probes for is present, there is no guarantee your Axis Service will work, because there are many configuration options that we do not check for. These tests are necessary but not sufficient

Examining Version Service

There was a problem in Axis2 version service , may be the service not available or some thing has gone wrong. But this does not mean system is not working ! Try to upload some other service and check to see whether it is working. 


Troubleshooting based on Log file errors 

Problem#1 

If you get the error as below,

[29/04/14 21:42:56:607 EDT] 0000001c webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[AxisServlet]: org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
at org.apache.axis2.engine.AxisConfiguration.engageModule(AxisConfiguration.java:584)
at org.apache.axis2.engine.AxisConfiguration.engageGlobalModules(AxisConfiguration.java:705)
at org.apache.axis2.deployment.DeploymentEngine.engageModules(DeploymentEngine.java:831)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.engageGlobalModules(WarBasedAxisConfigurator.java:300)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:94)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:577)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:883)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)

[29/04/14 21:42:56:612 EDT] 00000020 SystemOut     O [INFO] OMException in getSOAPBuilder
org.apache.axiom.om.OMException: SOAP message MUST NOT contain a Document Type Declaration(DTD)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createDTD(StAXSOAPModelBuilder.java:455)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:282)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:198)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:686)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
at com.ibm._jsp._HappyAxis.invokeTheService(_HappyAxis.java:372)
at com.ibm._jsp._HappyAxis._jspService(_HappyAxis.java:512)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:205)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:883)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)


Solution#1 : (Fix for The system is attempting to engage a module that is not available: addressing) 
Axis2.xml file attribute is not updated 

    <parameter name="EnableChildFirstClassLoading">true</parameter>

And also Step 32 and 33 if you are in UNIX or LINUX

Problem#2 

If you get the error as below,

[29/04/14 22:54:55:547 EDT] 00000017 WarBasedAxisC E org.apache.axis2.deployment.WarBasedAxisConfigurator <init> org.apache.commons.fileupload.FileUploadException
                                 org.apache.axis2.deployment.DeploymentException: org.apache.commons.fileupload.FileUploadException
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:774)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:234)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:859)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:156)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:569)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1283)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:973)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3639)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileUploadException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:77)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:139)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1345)
at org.apache.axis2.deployment.DescriptionBuilder.processMessageBuilders(DescriptionBuilder.java:230)
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:771)
... 28 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
... 35 more

[29/04/14 22:54:55:548 EDT] 00000017 AxisServlet   I org.apache.axis2.util.OnDemandLogger info org.apache.axis2.deployment.DeploymentException: org.apache.commons.fileupload.FileUploadException
[29/04/14 22:54:55:549 EDT] 00000017 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper init Uncaught.init.exception.thrown.by.servlet
[29/04/14 22:54:55:564 EDT] 00000017 ClusterBuilde I org.apache.axis2.deployment.ClusterBuilder buildCluster Clustering has been disabled
[29/04/14 22:54:55:566 EDT] 00000017 WarBasedAxisC E org.apache.axis2.deployment.WarBasedAxisConfigurator <init> org.apache.commons.fileupload.FileUploadException
                                 org.apache.axis2.deployment.DeploymentException: org.apache.commons.fileupload.FileUploadException
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:774)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:234)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:859)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:156)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:569)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:577)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3639)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileUploadException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:77)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:139)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1345)
at org.apache.axis2.deployment.DescriptionBuilder.processMessageBuilders(DescriptionBuilder.java:230)
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:771)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
... 37 more

[29/04/14 22:54:55:568 EDT] 00000017 AxisServlet   I org.apache.axis2.util.OnDemandLogger info org.apache.axis2.deployment.DeploymentException: org.apache.commons.fileupload.FileUploadException
[29/04/14 22:54:55:568 EDT] 00000017 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper init Uncaught.init.exception.thrown.by.servlet
[29/04/14 22:54:55:568 EDT] 00000017 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[AxisServlet]: org.apache.axis2.deployment.DeploymentException: org.apache.commons.fileupload.FileUploadException
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:774)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:234)
at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:859)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:156)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:569)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:577)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3639)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileUploadException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:77)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:139)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1345)
at org.apache.axis2.deployment.DescriptionBuilder.processMessageBuilders(DescriptionBuilder.java:230)
at org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:771)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
... 37 more

[29/04/14 22:54:55:576 EDT] 00000017 servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [axis2_1_6_2_war] [/axis2] [/axis2-web/Error/error500.jsp]: Initialization successful.


Solution#2 : (Fix for WarBasedAxisC E org.apache.axis2.deployment.WarBasedAxisConfigurator <init> org.apache.commons.fileupload.FileUploadException
Step 24, 25, 26 not done properly

Problem#3: java.lang.VerifyError: class loading constraint violated (class: org/apache/xerces/dom/CoreDocumentImpl method: getDomConfig()Lorg/w3c/dom/DOMConfiguration;) at pc: 0 


Solution#3 : (FIX for "java.lang.VerifyError: JVMVRFY013 class loading constraint violated" )


In the xmlbeans-2.3.0.jar à remove org.dom package




Recommendations: 
If you have a chance to update the Fix Pack for Websphere please do it which will resolve lot of bugs and issues
To view list of fix packs for IBM Websphere server check the link below,
http://www-01.ibm.com/support/docview.wss?uid=swg27004980

Also if you are planning to enabling Third Party JAX-WS
Use this link

Using a third-party JAX-WS Web services engine

 http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_thirdparty.html

Also i found this article is very useful but not detailed

http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html