This all works fine when running junit in eclipse. It is when I deploy my jar to the Oracle Serviec Bus and call it via a proxy I get the problem.
My jar uses httpClient & httpCore, httpClient also has some dependencies on httpCore. The problem happens when httpclient references httpcore without being referenced from my jar. I have proven that is the external jar referencing the other one by editing the manifest of httpclient to have the httpcore jar. All works if I do this but I do not want to be manually editing external jars as you would expect!
My manifest has this class-path set: Class-Path: httpcore-4.3.jar httpclient-4.3.1.jar DatabaseUtil-1.0.jar commons-codec-1.8.jar
I am working on adding the jars to the classpath of the server and I think this will work but checking is there another way to do this as there are other services/jars using the same jvm. I have copied a test class below to show proof of issue
Any help is much appreciated.
Thanks, Daniel.
public class CheckHTTPJars {
public static String checkHttpJarsLoaded()
{
try {
System.out.println("Starting...");
System.out.println("classpath: " + System.getProperty("java.class.path"));
HttpHost host = new HttpHost("test");
System.out.println("Hit HTTPCore... ");
BasicResponseHandler b = new BasicResponseHandler();
System.out.println("Hit HTTPClient... ");
HttpGet get = new HttpGet();
System.out.println("Hit HTTPClient but referencing HttpCore... ");
HttpRequest h = null;
System.out.println("Hit HTTPCore... ");
return("Passed");
} catch (Exception e) {
return (e.getMessage());
}
}
}