Hello,
I am facing a problem while loading classes of form-beans. Let me tell the configuration first.
Application Server --> OC4J10g(9.0.4.0)
J2SDK --> 1.4.2_05-b04
Struts --> 1.1
Now sometimes, while going from a .JSP page to action class, the server is unable to load the class of Form bean. While debugging struts code, I've found out that from RequestProcesser, RequestUtils' createActionForm method is being called. After getting the class, it tries to load it into the memory. And that is done by one method call in createActionForm method, i.e. applicationClass(
String className).
The code of this method is as follows:
public static Class applicationClass(String className) throws ClassNotFoundException {
// Look up the class loader to be used
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = RequestUtils.class.getClassLoader();
}
// Attempt to load the specified class
return (classLoader.loadClass(className));
}
While getting the instance of ClassLoader, it takes the current
thread's context class loader as mentioned in the code. Sometimes it is getting the correct loader, from which the class can be found out. But sometimes, it is taking some other loader. And because of that, the form bean class cannot be found out. Hence it throws exception. This problem is coming once in 10 times or so.
Actually I've upgrade the configuration from the below configuration to the configuration mentioned above. And it was working fine previously with the below configuration.
Application Server --> OC4J9iAS(9.0.3.6)
J2SDK --> 1.3.1_09-b03
Struts --> 1.1
Now, there is one work around. I am keeping the OC4J version as the new one i.e. 10g(9.0.4.0) but changing the version of jdk to previous one i.e. 1.3.1_09-b03. It started working fine. I have some testers allocated on this and it is working fine. Now, the configuration is as below:
Application Server --> OC4J10g(9.0.4.0)
J2SDK --> 1.3.1_09-b03
Struts --> 1.1
As our production server will have jdk version as 1.4.2, this work around will not the solve the purpose.
If anyone look into this and have any idea about class loader of jdk 1.4.2??
[ April 26, 2005: Message edited by: Bimal Patel ]