-1

When the below section of code is executed in my program I get an IOException.

try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(logStorageUrl.openStream())))  {
            String currentLine;
            while((currentLine = bufferedReader.readLine()) != null){
                Vault vlt = mapper.readValue(currentLine, Vault.class);
                logger.debug("Log Store Name: " + vlt.getvault_name());
                logger.debug("Log Store Vault: " + vault);
                if(vlt.getvault_name().equals(vault.toLowerCase())){
                    logger.debug("Per Vault Total log_store vault name: " + vlt.getvault_name() + ", bytes: " + vlt.getBytes());
                    byteCount += vlt.getBytes();
                }
            }
            logger.debug("Total LogStore ByteCount: " + byteCount);

} catch(IOException e){
            System.out.println("IO Exception " + e );
}

Here's the exception details:

IO Exception java.io.IOException: Server returned HTTP response code: 403 for URL: https://s3-api.XXXXXX.net/cr-test

I suspect it might be related to aws v4 authentication as that's the method I'm using and I already hit an issue with it but that seems to be resolved. Could it be something missing in my header? My previous issue was due to not passing 'host' in my header but I included it this time.

I know I passed the correct access and secret keys and I didn't select any particular headers to pass.

runnerpaul
  • 5,942
  • 8
  • 49
  • 118
  • First, what is a [403](https://en.wikipedia.org/wiki/HTTP_403). So I would guess you have reach a limit of daily request or anything similar. If not, check if there is nothing that you forget to provide to this API. Check the request with a REST Client first – AxelH May 26 '17 at 11:12
  • You'll have to post more information. Which service do you invoke, which headers do you send, how do you authenticate, ... – andih May 26 '17 at 11:13
  • HTTP Status code means FORBIDDEN, so you definitely have an authentication issue here – P.J.Meisch May 26 '17 at 13:12

1 Answers1

0

I was passing an incorrect uri. Once I got the correct uri I stopped getting the error.

runnerpaul
  • 5,942
  • 8
  • 49
  • 118