title: I am getting a java.util.MissingFormatArgumentException: Format specifier '%s' error in java
body: <p>I am getting a java.lang.RuntimeException:</p>
  <pre><code>java.util.MissingFormatArgumentException: Format specifier '%s' error in Java below is my stacktrace:
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformToListClass': Invocation of init method failed; nested exception is java.lang.RuntimeException: java.util.MissingFormatArgumentException: Format specifier '%s'
  
  Caused by: java.lang.RuntimeException: java.util.MissingFormatArgumentException: Format specifier '%s'
  
  Caused by: java.util.MissingFormatArgumentException: Format specifier '%s'
  </code></pre>
  <p>I am passing the below JSON file:</p>
  <pre><code>{
  &quot;EcrionIntegration&quot;: {
    &quot;HelloWord&quot;: &quot;Hello World&quot;
  }
  }
  </code></pre>
  <p>To the following method:</p>
  <pre><code>@PostConstruct
  public ResponseEntity&lt;InputStreamResource&gt; tranform() {
      try {
  
          JSONParser parser = new JSONParser();
  //Use JSONObject for simple JSON and JSONArray for array of JSON.
          JSONObject data = (JSONObject) parser.parse(new FileReader(&quot;C:\\Liver\\code\\HELLO_WORLD.json&quot;));//path to the JSON file.
  
          String payLoad = data.toString();
  
  
          ImageDescriptor descriptor = ecrionService.generateImage(payLoad, &quot;HELLO_WORLD&quot;);
  
          log.info(String.format(&quot;%s generateImage Result: [%s] &quot;, descriptor.getFileName(), descriptor.getFileUrl()));
          System.out.print(descriptor.getFileName() + &quot; &quot; + descriptor.getFileUrl());
  
          String fileName = &quot;ecrionlList.PDF&quot;;
          log.info(String.format(&quot;file name:&quot;, fileName));
          System.out.print(&quot;file name:&quot; + fileName);
          descriptor.setFileName(fileName);
  
          InputStreamResource streamResource = new InputStreamResource(descriptor.getInputStream());
          return ResponseEntity.ok()
                  .contentType(MediaType.parseMediaType(MediaType.APPLICATION_PDF_VALUE))
                  .body(streamResource);
  
      } catch (Exception ex) {
          throw new RuntimeException(ex);
      }
  }
  </code></pre>
  <p>}</p>
  <p>Which is in turn passed to the following method and send to the server:</p>
  <pre><code>public ImageDescriptor generateImage(String payLoad, String templateName) {
      try {
          ImageDescriptor descriptor = new ImageDescriptor();
  
          String myEcrionUrl = &quot;http://localhost:8013/v1/ecrion&quot;;
        String ecrionURL = myEcrionUrl.concat(Constant.F_SLASH).concat(templateName);
  
  
  
          log.info(&quot;payload&quot; + payLoad);
  
          ResponseEntity&lt;Resource&gt; responseEntity = restTemplate.exchange(
                  ecrionURL,
                  HttpMethod.POST,
                  ncbiService.getStringHttpEntityWithPayload(payLoad),
                  Resource.class);
        log.info(String.format(&quot;%s generateImage Result: [%s] &quot;, responseEntity.getBody().getInputStream()));
          descriptor.setInputStream(Objects.requireNonNull(responseEntity.getBody()).getInputStream());
  
          convert(responseEntity.getBody().getInputStream(), &quot;sherrr.pdf&quot;);
  
          log.info(&quot;file is:&quot;+ convert(responseEntity.getBody().getInputStream(), &quot;sherrr.pdf&quot;));
  
          return descriptor;
      } catch (IOException e) {
          e.printStackTrace();
          log.error(&quot; generate image failed &quot; + e.getMessage());
          throw new RuntimeException(e);
      }
  
  
  
  
   }
  </code></pre>