Hi there,
I have the task of migrating a custom webMethods adapter from 9.9 to 10.7 and have some issues when compiling the Java code as I get below error message:
com.wm.app.b2b.server.ServiceException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.configuration.FileSystem
In the code/jars location I have following jars: commons-configuration-1.10.jar, commons-lang.jar, commons-logging.jar, log4j.jar (beside the jar having the code for the custom adapter)
I also added below entry in the manifest.v3 file so that the jars from /code/jars are loaded first:
<value name="classloader">package</value>
However, it is still not working.
After an extended investigation, I extracted the exact code which throws the exception in a Java service and also wrapped it inside a try catch block to extract the Throwable info:
try{
FileSystem fileSystem = FileSystem.getDefaultFileSystem();
}
catch(Throwable t){
throw new ServiceException(t);
}
Below you have the real error detail that I managed to get when running the Java service on the 10.7 server:
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.logging.log4j.jcl.LogFactoryImpl' cannot be converted to 'org.apache.commons.logging.LogFactory'. The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders.
On the 9.9 server, the same Java service works.
Could this be caused because of the built in log4j jars found on the global server classpaths on the 10.7 server? If so, is there a setting so that at runtime only the jars from code/jars are to be taken into consideration?
Best regards,
n23