By writing this code and executing the same in the Production Environment we were able to find the cause of the problem as missing JAR files in the EAR. This code snippet can be used to know all the system properties of the web application.
<%@ page contentType="text/html;charset=windows-1252"%>
System Properties TEST
<%@ page language="java" import="java.util.*, java.io.* " %>
<%
out.println("System Properties Listing
");
// Set a system property
System.setProperty("ApplicationHosting", "J2EE Hosting Service");
// Get all system properties
Properties props = System.getProperties();
String propName = "";
String propValue = "";
// Enumerate all system properties
Enumeration enum = props.propertyNames();
out.println("");
for (; enum.hasMoreElements(); ) {
// Get property name
propName = (String)enum.nextElement();
// Get property value
propValue = (String)props.get(propName);
out.println("- Property Name: " + propName + ", Value: " );
if(propValue.indexOf(":") > 0 ){
if(propValue.indexOf("http://") >= 0 ){
out.println(propValue + "
");
}else{
out.println("");
while(propValue.indexOf(":") > 0 ){
out.println("- " +
propValue.substring(0, propValue.indexOf(":")) + "
");
propValue = propValue.substring(propValue.indexOf(":") + 1, propValue.length());
}
out.println("
");
}
}else{
out.println(propValue + "\n");
}
}
out.println("
\n");
%>
This listing is at the application level, it shows jar components from the WEB-INF/lib dir of the application. After that is the Application Server Instance level classloader.
<% ClassLoader classloader = Thread.currentThread().getContextClassLoader();
String s = "";
while (classloader != null){
out.println("");
s = classloader.toString();
if(s.indexOf("ClassLoader:") >=0){s = s.substring(12, s.length());}
while(s.indexOf(",") > 0 ){
if((s.indexOf("[/") ==0)||(s.indexOf("[") ==0)){
s = s.substring(s.indexOf("[") +1, s.length());
}
out.println("- " + s.substring(s.indexOf("[")+1, s.indexOf("],")) + "
");
s = s.substring(s.indexOf("],") + 2, s.length());
}
out.println("
");
classloader = classloader.getParent();
}
%>
The System environment
<%
out.println("Environment:
");
try {
Process p = Runtime.getRuntime().exec("/usr/bin/env");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
for (String data = in.readLine(); data != null; data = in.readLine())
out.println(data);
}
catch(IOException x) {
}
out.println("
End of Environment output.");
%>