ClassNotFoundException - different behaviour on JBoss 7.1
akash_bansal Oct 29, 2013 6:55 AMHi,
I have two classes one is OutData and the other is ExtendedData as given below:
OutData.java:
public class OutData implements Serializable {
public OutData(String internetAddress, String hostName) {
this.internetAddress = internetAddress;
this.hostName = hostName;
}
private String internetAddress;
private String hostName;
public String getInternetAddress() {
return internetAddress;
}
public void setInternetAddress(String internetAddress) {
this.internetAddress = internetAddress;
}
public String getHostName() {
return hostName;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
}
ExtendedData.java:
public class ExtendedData extends OutData implements Serializable {
public ExtendedData(String internetAddress, String hostName,
String testProperty) {
super(internetAddress, hostName);
this.testProperty = testProperty;
}
private String testProperty;
public String getTestProperty() {
return testProperty;
}
public void setTestProperty(String testProperty) {
this.testProperty = testProperty;
}
}
One of my sessionbean has following source code:
public interface RemoteCalculator {
OutData responseFrom();
}
public class CalculatorBean implements RemoteCalculator {
@Override
public OutData responseFrom() {
String ipAddress = null;
OutData outData = null;
try {
InetAddress ip = InetAddress.getLocalHost();
ipAddress = ip.getHostAddress();
String nodeName = System.getProperty("jboss.node.name");
System.out.println("Response from " + ipAddress + " NodeName: " + nodeName);
ExtendedData extendedData = new ExtendedData(ipAddress, nodeName, "Test Property");
outData = (OutData)extendedData;
} catch (UnknownHostException e) {
e.printStackTrace();
}
return outData;
}
I have deployed all these four classes on JBoss 7.1.3 server.
My EJB Client has only TWO classes - RemoteCalculator.class and OutData.class. When I call responseFrom() method of above session bean from JBoss, it throws ClassNotFoundException : ExtendedData.
When I deploy same EJB on Weblogic 10.3 server, it works fine. It does not throw ClassNotFoundException : ExtendedData even though my ejb client does not have class definition of ExtendedData.
I am attaching the source code of my session bean along with OutData and ExtendedData for ready reference.
I would request to JBoss SMEs about the different behaviour of the same.
Regards,
Akash
-
src.rar 2.7 KB