How to Resolve the Exception While Calling Pentaho REST API

Posted on by By admin, in Pentaho | 0

Pentaho REST API

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Click Here to Free Download PKIX path building failed.
Prerequisites: Eclipse Neon, JDK 1.8

When we tried to call the REST API to verify users we may get this exception

Reasons for this exception is that it occurs because HTTPS is a secure protocol. If we want to call that API, the system requires certificates related to security. First, you need to obtain the public certificate from the server you’re trying to connect to. That can be done in a variety of ways, such as contacting the server admin and asking for it. I followed the below-mentioned way to resolve the problem.

User_URL : “https://” + host + “”

Source code :

public static boolean validateUser(String host, String username, String api_key) throws ParseException {
			String userUrl = "https://" + host + "";
			System.out.println("Final URL :  " + userUrl);
		try {
			URL url = new URL(userUrl);
			HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); 
			conn.setRequestProperty("Content-Type", "application/json");
			conn.setRequestProperty("Accept", "json");
			JSONObject jsObje = new JSONObject();
			jsObje.put("username", username);
			jsObje.put("api_key", api_key);
			try (OutputStream output = conn.getOutputStream()) {
		} catch (IOException e) {

	return true;


If we run the code we get the following Exception PKIX path building failed.

To resolve this add the below code beginning of the method.

TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
			public[] getAcceptedIssuers() {
				return null;

			public void checkClientTrusted([] certs, String authType) {

			public void checkServerTrusted([] certs, String authType) {
		} };

		try {
			SSLContext sc = SSLContext.getInstance("SSL");
			sc.init(null, trustAllCerts, new;
		} catch (Exception e) {

The code adds required security certificates into a system. It handles that exception.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Get your 30 Days Trail Version


Best Open Source Business Intelligence Software Helical Insight is Here


A Business Intelligence Framework

In Case if you have any queries please get us at
Thank You
Anjaneyulu Patturi
Helical IT Solutions Pvt Ltd

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments