Hi, can anybody help me with mysterious problem on MAXIMO 7.6.1.x where code that worked in previous versions suddenly fails.
code is pretty simple (it is a method in a bean class which executes the following):
try {
URIBuilder uri_bld = new URIBuilder();
uri_bld.setScheme("https")
.setHost("some.server")
.setPort(8101)
.setPath("/some/path");
URI htt_uri = uri_bld.build();
/* both variants HttpClientBuilder.build() or HttpClients.createDefault()
fail for the same reason
CloseableHttpClient htt_cln = HttpClientBuilder.create()
.useSystemProperties()
.build();
*/
CloseableHttpClient htt_cln = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(htt_uri);
CloseableHttpResponse response = htt_cln.execute(httpGet);
String responseContent = EntityUtils.toString(response.getEntity());
} catch (Exception e) {
e.printStackTrace();
}
the error given is:
15.10.2020 13:04:59:663 CEST] 00000137 SystemErr R java.lang.NoClassDefFoundError: org.apache.http.impl.conn.ManagedHttpClientConnectionFactory (initialization failure)
at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:96)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingHttpClientConnectionManager.java:572)
.....
Caused by: java.lang.NoSuchFieldError: org/apache/http/message/BasicLineFormatter.INSTANCE
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
The code depend only on libraries provided by IBM (and Apache HTTP Client but were included by IBM into lib folder of MAXIMO)
Classloader suggests all appropriate classes are loaded.
Best regards
Matej Potočnik
#Maximo#AssetandFacilitiesManagement#SupportMigration#Support