I am not able to read a image from Java Code which is hosted in Amazon Cloudfront -


we have image processing server running in amazon ec2. have n-number of instances running our image processing server. reads image origin server hosted in amazon cdn.

the problem here image loading in browser directly hitting in java code getting nullpointer exception bufferedimage null. after time able read image take weeks view. rare occurrence stuck totally . please advice on this

image request response header

via:1.1 abc.cloudfront.net (cloudfront), 1.0 amazon-instnce-a.com:8080 (squid/2.6.stable21)

here amazon-instnce-a.com:8080 terminated , no longer available why routed request here.

what way can code in java 6 retrieve image ? using below snippet retrieve image.

    static httpclient httpclient;       static void  getimage(string uri){         httpget = new httpget(uri);          try {             httpclient = httpclientbuilder.create().build();             httpresponse response = httpclient.execute(get);             httpentity entity = response.getentity();              bufferedimage bufferedimage = null;             inputstream = entity.getcontent();             imageio.setusecache(false);             bufferedimage = imageio.read(is);             if(bufferedimage == null){                     system.out.println("null"); // got null here             }             is.close();           } catch (clientprotocolexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         }     } 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -