title: Through maven gettting error byte array is not a recognized imageformat
body: <p>I'm trying to read an image present in one of the package and place it in my pdf (Using iText). When I deploy the application in my RAD-WAS it is successfully creating the PDF with the image. But when I generate the EAR through maven and deploy in WAS it shows error.</p>
  
  <p>Piece of code is </p>
  
  <pre><code>InputStream inStream = this.getClass().getClassLoader().getResourceAsStream("com/myComp/pdf/logo/image.tif");
  LOGGER.error("inStream = " +inStream);
  Image img = null;
          try{
  
              img = Image.getInstance(IOUtils.toByteArray(inStream));
              LOGGER.error("img =" + img);
  
          }catch(IOException ex) {
              LOGGER.error("Caught   IOException ="+ex);
          }
  </code></pre>
  
  <p>Output :</p>
  
  <p>1) When Deployed locally</p>
  
  <pre><code>inStream = java.io.BufferedInputStream@10f910f9
  </code></pre>
  
  <p>and it runs successfully</p>
  
  <p>2) When EAR generated through maven</p>
  
  <pre><code>inStream = com.ibm.ws.classloader.Handler$ZipEntryInputStream@489e489e 
  Caught   IOException =java.io.IOException: The byte array is not a recognized imageformat.
  </code></pre>
  
  <p>In my POM I have kept </p>
  
  <pre><code>&lt;dependencies&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
         &lt;artifactId&gt;bootstrap&lt;/artifactId&gt;
         &lt;version&gt;7.0.0.19&lt;/version&gt;
         &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
          &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
          &lt;artifactId&gt;com.ibm.jaxb.tools&lt;/artifactId&gt;
          &lt;version&gt;7.0.0.19&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  ....
  &lt;dependencies&gt;
  </code></pre>
  
  <p>In my POM I have kept filter properties as below </p>
  
  <pre><code>&lt;resource&gt;
              &lt;directory&gt;${project.basedir}/${rad.sourcedir}
              &lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.java&lt;/exclude&gt;
                  &lt;exclude&gt;*.classpath&lt;/exclude&gt;
                  &lt;exclude&gt;*.project&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  </code></pre>
  
  <p>And also kept properties like</p>
  
  <pre><code>&lt;properties&gt;
      &lt;application.systemletters&gt;IRI&lt;/application.systemletters&gt;
      &lt;project.build.sourceEncoding&gt;Cp1252&lt;/project.build.sourceEncoding&gt;
  .....
  &lt;/properties&gt;
  </code></pre>
  
  <p>I treid to remove the "this.getClass().getClassLoader().getResourceAsStream" by reading it as new File("..") but still isn't successful. </p>
  
  <pre><code>File file1 = new File("com/myComp/pdf/logo/image.tif"); 
            InputStream fIn = new FileInputStream(file1); 
             LOGGER.error("fIn="+fIn);
            BufferedInputStream bIn = new BufferedInputStream(fIn);  
             LOGGER.error("bIn="+bIn);
  Image img = null;
          try{
  
              img = Image.getInstance(IOUtils.toByteArray(inStream));
              LOGGER.error("img =" + img);
  
          }catch(IOException ex) {
              LOGGER.error("Caught   IOException ="+ex);
          }
  </code></pre>
  
  <p>OutPut :</p>
  
  <pre><code>fIn=java.io.FileInputStream@3dac3dac
  bIn=java.io.BufferedInputStream@c420c42
  Caught   IOException =java.io.IOException: The byte array is not a recognized imageformat. 
  </code></pre>
  
  <p>Now, how do I get my image to come in PDF via maven also.</p>