goldbergjeffrey / QlikSenseTicket.java

A simple example of how to request a ticket from Qlik Sense Proxy Service API using java
8 stars 12 forks source link

Unable to generate webticket #1

Closed prasad8mhatre closed 8 years ago

prasad8mhatre commented 8 years ago

We followed the step provided by you, but when we executed it we got following error, We tried using node.js "https://community.qlik.com/docs/DOC-8160" --> Access Control Test Module.It worked for us. But for java, we are unable to get this.

_javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.processrecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source) at Ticket.main(Ticket.java:62) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(Unknown Source) at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) at sun.security.validator.Validator.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ... 14 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) at java.security.cert.CertPathBuilder.build(Unknown Source) ... 20 more

Please help us.

goldbergjeffrey commented 8 years ago

Hi Prasad, it looks like this error is a result of potentially a couple of issues.

  1. The certificate you are using does not match the certificate for the hostname you are attempting to contact.
  2. The java keystores are not properly set up and consequently there is a problem reading the response.
  3. The hostname and the virtual proxy prefix are not set in the configuration. I doubt it's this one.
prasad8mhatre commented 8 years ago

Hi Goldberg Jeffrey, I have cloned your repo. 1.while exporting the certificate from QMC , I have given the same name as of my hostname. QMC dashboard > certificates > export certificates.(I have got 3 certificates, client.pfx, root.cer, server.pfx) , when i executed those command (root.jks, and client.jks created.) 2.About java keystore, I have used the same command as given in your document.(Is there any other command to do?) 3.I have set the hostname and virtual proxy in config.

I am using java 1.8, windows 7, qliksense 2.2

What else I am missing?

prasad8mhatre commented 8 years ago

Thank's for your support. It worked!

tanvimadan commented 7 years ago

Hi,

I too tired same code but i am also getting SSL handshake error. Could please suggest how you was able to solve the problem

goldbergjeffrey commented 7 years ago

@tanvimadan, please see the comment above from May 5, 2016. It is likely you do not have or have an improperly formatted java keystore for connecting to Qlik Sense through the java ticket solution. You will need at least the client certificate, client key, and root cert in the java keystore in order to make a successful connection to the proxy rest api.

tanvimadan commented 7 years ago

Thanks for response. I am successful in getting the ticket response. Just provided wrong host name in the URL hence was not able to connect.