Closed srikant-mvs closed 5 years ago
The 403 response code indicates an authorization issue. So you are either not specifying your credentials correctly to the sample application or the set of credentials you are using does not have the correct permissions.
Can you share the command you are using to run the sample (without putting your apikey) ?
Closing this issue as there's been no reply for a few weeks.
Please re-open with the requested data if this is still an issue.
Hi Team, I have setup the sample code by following the instructions from the document link. When I run the producer command, I see the below error.
INFO Creating the topic kafka-java-console-sample-topic (com.eventstreams.samples.EventStreamsConsoleSample) ERROR REST POST request failed with exception: java.io.IOException: Server returned HTTP response code: 403 for URL: https://xxxx.containers.appdomain.cloud/admin/topics (com.eventstreams.samples.rest.RESTRequest) java.io.IOException: Server returned HTTP response code: 403 for URL: https://xxxx.containers.appdomain.cloud/admin/topics at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at com.eventstreams.samples.rest.RESTRequest.post(RESTRequest.java:162) at com.eventstreams.samples.rest.RESTAdmin.createTopic(RESTAdmin.java:46) at com.eventstreams.samples.EventStreamsConsoleSample.main(EventStreamsConsoleSample.java:176)
After doing some research over the internet, I also tried adding the code in
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36");
in the RestRequest, but still no luck.I get response from the browser, but not from the java code. Please help and let me know what am I missing here.