It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Problem with json-rpc in client side

Hi all,

I am new to confluence. I am try to use json-rpc api to create a new space on confluence via java prgram.

(The confluence is running on the virtual box on my computer)

here is my code:

import com.thetransactioncompany.jsonrpc2.client.*;

import com.thetransactioncompany.jsonrpc2.*;

import net.minidev.json.*;


public class JsonRpcClient {

static {


public boolean verify(String hostname, sslSession) {

if (hostname.equals("myserver")) {

return true;


return false;




public void createSpace(){

URL serverURL = null;


serverURL = new URL ("https://myserver/rpc/json-rpc/confluenceservice-v2");

}catch(MalformedURLException e){



JSONRPC2Session mySession = new JSONRPC2Session(serverURL);

mySession.setConnectionConfigurator(new BasicAuthenticator());

String jsonString = "{\"jsonrpc\" : \"2.0\", \"method\" : \"addSpace\", \"params\" : \n" +

" {\"key\" : \"DS\", \"name\" : \"Document Space\",\"description\" : \"This is a test\" },\"id\":\"12345\"}";

JSONRPC2Request request = null;


request = JSONRPC2Request.parse(jsonString);

}catch(JSONRPC2ParseException e){



JSONRPC2Response response = null;

try {

response = mySession.send(request);

} catch (JSONRPC2SessionException e) {


// handle exception...


// Print response result / error

if (response.indicatesSuccess())





public static void main (String[] args){

JsonRpcClient client = new JsonRpcClient();




Then, I will get
Network exception: PKIX path building failed: unable to find valid certification path to requested target
What should I do ?
Thanks alot

3 answers

1 accepted

1 vote
Answer accepted


your keystore is not containing a certificate for the SSL handshake. Please review this page for further instructions

HTH, Sabine

Hi Sabine,

Appreciate for your response, I figure ou the problem, I also review the following link

I waste lots of time because I put the certificate in the wrong keystore !



Hi Jeremy,

this sounds good. If the answer helped you please mark it to close this thread.

Thanks, Sabine

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

286 views 5 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you